41bb726c

appendix J

java.lang Package Reference


CONTENTS

The java.lang package provides the core classes that make up the Java programming environment. The language package includes classes representing numbers, strings, and objects, as well as classes for handling compilation, the runtime environment, security, and threaded programming. The java.lang package is automatically imported into every Java program.

Cloneable

This interface indicates that an object may be cloned using the clone method defined in Object. The clone method clones an object by copying each of its member variables. Attempts to clone an object that doesn't implement the Cloneable interface result in a CloneNotSupportedException being thrown.

Runnable

This interface provides a means for an object to be executed within a thread without having to be derived from the Thread class. Classes implementing the Runnable interface supply a run method that defines the threaded execution for the class.

run

public abstract void run()
This method is executed when a thread associated with an object implementing the Runnable interface is started. All of the threaded execution for the object takes place in the run method, which means you should place all threaded code in this method.

Boolean

Extends: Object
This class implements an object type wrapper for boolean values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static Boolean FALSE

This is a constant Boolean object representing the primitive boolean value false.

public final static Boolean TRUE

This is a constant Boolean object representing the primitive boolean value true.

Boolean Constructor

public Boolean(boolean value)
This constructor creates a boolean wrapper object representing the specified primitive boolean value.
Parameters: value-the boolean value to be wrapped.

Boolean Constructor

public Boolean(String s)
This constructor creates a boolean wrapper object representing the specified string. If the string is set to "true", the wrapper represents the primitive boolean value true; otherwise, the wrapper represents false.
Parameters: s-the string representation of a boolean value to be wrapped.

booleanValue

public boolean booleanValue()
This method determines the primitive boolean value represented by this object.
Returns: The boolean value represented.

equals

public boolean equals(Object obj)
This method compares the boolean value of the specified object to the boolean value of this object. The equals method returns true only if the specified object is a Boolean object representing the same primitive boolean value as this object.
Parameters: obj-the object to compare.
Returns: true if the specified object is a Boolean object representing the same primitive boolean value as this object; false otherwise.

getBoolean

public static boolean getBoolean(String name)
This method determines the boolean value of the system property with the specified name.
Parameters: name-the system property name to check the boolean value of.
Returns: The boolean value of the specified system property.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

toString

public String toString()
This method determines a string representation of the primitive boolean value for this object. If the boolean value is true, the string "true" is returned; otherwise, the string "false" is returned.
Returns: A string representing the boolean value of this object.

valueOf

public static Boolean valueOf(String s)
This method creates a new boolean wrapper object based on the boolean value represented by the specified string. If the string is set to "true", the wrapper represents the primitive boolean value true; otherwise, the wrapper represents false.
Parameters: s-the string representation of a boolean value to be wrapped.
Returns: A boolean wrapper object representing the specified string.

Character

Extends: Object
This class implements an object type wrapper for character values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static int MAX_RADIX

This is a constant representing the maximum radix value allowed for conversion between numbers and strings. This constant is set to 36.

public final static int MAX_VALUE

This is a constant representing the largest character value supported. This constant is set to '\uffff'.

public final static int MIN_RADIX

This is a constant representing the minimum radix value allowed for conversion between numbers and strings. This constant is set to 2.

public final static int MIN_VALUE

This is a constant representing the smallest character value supported. This constant is set to '\u0000'.

Character Constructor

public Character(char value)
This constructor creates a character wrapper object representing the specified primitive character value.
Parameters: value-the character value to be wrapped.

charValue

public char charValue()
This method determines the primitive character value represented by this object.
Returns: The character value represented.

digit

public static int digit(char ch, int radix)
This method determines the numeric value of the specified character digit using the specified radix.
Parameters:
ch-the character to be converted to a number.
radix-the radix to use in the conversion.
Returns: The numeric value of the specified character digit using the specified radix, or -1 if the character isn't a valid numeric digit.

equals

public boolean equals(Object obj)
This method compares the character value of the specified object to the character value of this object. The equals method returns true only if the specified object is a Character object representing the same primitive character value as this object.
Parameters: obj-the object to compare.
Returns: true if the specified object is a Character object representing the same primitive character value as this object; false otherwise.

forDigit

public static char forDigit(int digit, int radix)
This method determines the character value of the specified numeric digit using the specified radix.
Parameters:
digit-the numeric digit to be converted to a character.
radix-the radix to use in the conversion.
Returns: The character value of the specified numeric digit using the specified radix, or 0 if the number isn't a valid character.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

isDefined

public static boolean isDefined(char ch)
This method determines if the specified character has a defined Unicode meaning. A character is defined if it has an entry in the Unicode attribute table.
Parameters: ch-the character to be checked.
Returns: true if the character has a defined Unicode meaning; false otherwise.

isDigit

public static boolean isDigit(char ch)
This method determines if the specified character is a numeric digit. A character is a numeric digit if its Unicode name contains the word DIGIT.
Parameters: ch-the character to be checked.
Returns: true if the character is a numeric digit; false otherwise.

isJavaLetter

public static boolean isJavaLetter(char ch)
This method determines if the specified character is permissible as the leading character in a Java identifier. A character is considered a Java letter if it is a letter, the ASCII dollar sign character ($), or the underscore character (_).
Parameters: ch-the character to be checked.
Returns: true if the character is a Java letter; false otherwise.

isJavaLetterOrDigit

public static boolean isJavaLetterOrDigit(char ch)
This method determines if the specified character is permissible as a non-leading character in a Java identifier. A character is considered a Java letter or digit if it is a letter, a digit, the ASCII dollar sign character ($), or the underscore character (_).
Parameters: ch-the character to be checked.
Returns: true if the character is a Java letter or digit; false otherwise.

isLetter

public static boolean isLetter(char ch)
This method determines if the specified character is a letter.
Parameters: ch-the character to be checked.
Returns: true if the character is a letter; false otherwise.

isLetterOrDigit

public static boolean isLetterOrDigit(char ch)
This method determines if the specified character is a letter or digit.
Parameters: ch-the character to be checked.
Returns: true if the character is a letter or digit; false otherwise.

isLowerCase

public static boolean isLowerCase(char ch)
This method determines if the specified character is a lowercase character.
Parameters: ch-the character to be checked.
Returns: true if the character is a lowercase character; false otherwise.

isSpace

public static boolean isSpace(char ch)
This method determines if the specified character is a whitespace character.
Parameters: ch-the character to be checked.
Returns: true if the character is a whitespace character; false otherwise.

isTitleCase

public static boolean isTitleCase(char ch)
This method determines if the specified character is a titlecase character. Titlecase characters are those whose printed representations look like pairs of Latin letters.
Parameters: ch-the character to be checked.
Returns: true if the character is a titlecase character; false otherwise.

isUpperCase

public static boolean isUpperCase(char ch)
This method determines if the specified character is an uppercase character.
Parameters: ch-the character to be checked.
Returns: true if the character is an uppercase character; false otherwise.

toLowerCase

public static char toLowerCase(char ch)
This method converts the specified character to a lowercase character, if the character isn't already lowercase and a lowercase equivalent exists.
Parameters: ch-the character to be converted.
Returns: The lowercase equivalent of the specified character, if one exists; otherwise, the original character.

toString

public String toString()
This method determines a string representation of the primitive character value for this object; the resulting string is one character in length.
Returns: A string representing the character value of this object.

toTitleCase

public static char toTitleCase(char ch)
This method converts the specified character to a titlecase character, if the character isn't already titlecase and a titlecase equivalent exists. Titlecase characters are those whose printed representations look like pairs of Latin letters.
Parameters: ch-the character to be converted.
Returns: The titlecase equivalent of the specified character, if one exists; otherwise, the original character.

toUpperCase

public static char toUpperCase(char ch)
This method converts the specified character to an uppercase character, if the character isn't already uppercase and an uppercase equivalent exists.
Parameters: ch-the character to be converted.
Returns: The uppercase equivalent of the specified character, if one exists; otherwise, the original character.

Class

Extends: Object
This class implements a runtime descriptor for classes and interfaces in a running Java program. Instances of Class are automatically constructed by the Java virtual machine when classes are loaded, which explains why there are no public constructors for the class.

forName

public static Class forName(String className) throws ClassNotFoundException
This method determines the runtime class descriptor for the class with the specified name.
Parameters: className-the fully qualified name of the desired class.
Returns: The runtime class descriptor for the class with the specified name.
Throws: ClassNotFoundException if the class could not be found.

getClassLoader

public ClassLoader getClassLoader()
This method determines the class loader for this object.
Returns: The class loader for this object, or null if the class wasn't created by a class loader.

getInterfaces

public Class[] getInterfaces()
This method determines the interfaces implemented by the class or interface represented by this object.
Returns: An array of interfaces implemented by the class or interface represented by this object, or an array of length 0 if no interfaces are implemented.

getName

public String getName()
This method determines the fully qualified name of the class or interface represented by this object.
Returns: The fully qualified name of the class or interface represented by this object.

getSuperclass

public Class getSuperclass()
This method determines the superclass of the class represented by this object.
Returns: The superclass of the class represented by this object, or null if this object represents the Object class.

isInterface

public boolean isInterface()
This method determines if the class represented by this object is actually an interface.
Returns: true if the class is an interface; false otherwise.

newInstance

public Object newInstance() throws InstantiationException, IllegalAccessException
This method creates a new default instance of the class represented by this object.
Returns: A new default instance of the class represented by this object.
Throws: InstantiationException if you try to instantiate an abstract class or an interface, or if the instantiation fails for some other reason.
Throws: IllegalAccessException if the class is not accessible.

toString

public String toString()
This method determines the name of the class or interface represented by this object, with the string "class" or the string "interface" prepended appropriately.
Returns: The name of the class or interface represented by this object, with a descriptive string prepended indicating whether the object represents a class or interface.

ClassLoader

Extends: Object
This class is an abstract class that defines a mechanism for dynamically loading classes into the Java runtime system.

ClassLoader Constructor

protected ClassLoader()
This constructor creates a default class loader. If a security manager is present, it is checked to see if the current thread has permission to create the class loader. If not, a SecurityException is thrown.
Throws: SecurityException if the current thread doesn't have permission to create the class loader.

defineClass

protected final Class defineClass(byte b[], int off, int len)
This method converts an array of bytes into an instance of class Class by reading len bytes from the array b beginning off bytes into the array.
Parameters:
b-the byte array containing the class data.
off-the starting offset into the array for the data.
len-the length in bytes of the class data.
Returns: A Class object created from the class data.
Throws: ClassFormatError if the class data does not define a valid class.

findSystemClass

protected final Class findSystemClass(String name) throws ClassNotFoundException
This method finds the system class with the specified name, loading it if necessary. A system class is a class loaded from the local file system with no class loader in a platform-specific manner.
Parameters: name-the name of the system class to find.
Returns: A Class object representing the system class.
Throws: ClassNotFoundException if the class is not found.
Throws: NoClassDefFoundError if a definition for the class is not found.

loadClass

protected abstract Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
This method loads the class with the specified name, resolving it if the resolve parameter is set to true. This method must be implemented in all derived class loaders, because it is defined as abstract.
Parameters:
name-the name of the desired class.
resolve-a boolean value specifying whether the class is to be resolved; a value of true means the class is resolved, whereas a value of false means the class isn't resolved.
Returns: The loaded Class object, or null if the class isn't found.
Throws: ClassNotFoundException if the class is not found.

resolveClass

protected final void resolveClass(Class c)
This method resolves the specified class so that instances of it can be created or so that its methods can be called.
Parameters: c-the class to be resolved.

Compiler

Extends: Object
This class provides the framework for native Java code compilers and related services. The Java runtime system looks for a native code compiler on startup, in which case the compiler is called to compile Java bytecode classes into native code.

command

public static Object command(Object any)
This method performs some compiler-specific operation based on the type of specified object and its related state.
Parameters: any-the object to perform an operation based on.
Returns: A compiler-specific value, or null if no compiler is available.

compileClass

public static boolean compileClass(Class clazz)
This method compiles the specified class.
Parameters: clazz-the class to compile.
Returns: true if the compilation was successful, false if the compilation failed or if no compiler is available.

compileClasses

public static boolean compileClasses(String string)
This method compiles all classes whose names match the specified string name.
Parameters: string-a string containing the name of the classes to compile.
Returns: true if the compilation was successful, false if the compilation failed or if no compiler is available.

disable

public static void disable()
This method disables the compiler.

enable

public static void enable()
This method enables the compiler.

Double

Extends: Number
This class implements an object type wrapper for double values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static double MAX_VALUE

This is a constant representing the maximum value allowed for a double. This constant is set to 1.79769313486231570e+308d.

public final static double MIN_VALUE

This is a constant representing the minimum value allowed for a double. This constant is set to 4.94065645841246544e-324d.

public final static double NaN

This is a constant representing the not-a-number value for double types, which is not equal to anything, including itself.

public final static double NEGATIVE_INFINITY

This is a constant representing negative infinity for double types.

public final static double POSITIVE_INFINITY

This is a constant representing positive infinity for double types.

Double Constructor

public Double(double value)
This constructor creates a double wrapper object representing the specified primitive double value.
Parameters: value-the double value to be wrapped.

Double Constructor

public Double(String s) throws NumberFormatException
This constructor creates a double wrapper object representing the specified string. The string is converted to a double using a similar technique as the valueOf method.
Parameters: s-the string representation of a double value to be wrapped.
Throws: NumberFormatException if the string does not contain a parsable double.

doubleToLongBits

public static long doubleToLongBits(double value)
This method determines the IEEE 754 floating-point double precision representation of the specified double value. The IEEE 754 floating-point double precision format specifies the following bit layout:
Parameters: value-the double value to convert to the IEEE 754 format.
Returns: The IEEE 754 floating-point representation of the specified double value.

doubleValue

public double doubleValue()
This method determines the primitive double value represented by this object.
Returns: The double value represented.

equals

public boolean equals(Object obj)
This method compares the double value of the specified object to the double value of this object. The equals method only returns true if the specified object is a Double object representing the same primitive double value as this object. Note that to be useful in hash tables, this method considers two NaN double values to be equal, even though NaN technically is not equal to itself.
Parameters: obj-the object to compare.
Returns: true if the specified object is a Double object representing the same primitive double value as this object; false otherwise.

floatValue

public float floatValue()
This method converts the primitive double value represented by this object to a float.
Returns: A float conversion of the double value represented.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

intValue

public int intValue()
This method converts the primitive double value represented by this object to an integer.
Returns: An integer conversion of the double value represented.

isInfinite

public boolean isInfinite()
This method determines if the primitive double value represented by this object is positive or negative infinity.
Returns: true if the double value is positive or negative infinity; false otherwise.

isInfinite

public static boolean isInfinite(double v)
This method determines if the specified double value is positive or negative infinity.
Parameters: v-the double value to be checked.
Returns: true if the double value is positive or negative infinity; false otherwise.

isNaN

public boolean isNaN()
This method determines if the primitive double value represented by this object is not a number (NaN).
Returns: true if the double value is not a number; false otherwise.

isNaN

public static boolean isNaN(double v)
This method determines if the specified double value is not a number (NaN).
Parameters: v-the double value to be checked.
Returns: true if the double value is not a number; false otherwise.

longBitsToDouble

public static double longBitsToDouble(long bits)
This method determines the double representation of the specified IEEE 754 floating-point double precision value. The IEEE 754 floating-point double precision format specifies the following bit layout:
Parameters: bits-the IEEE 754 floating-point value to convert to a double.
Returns: The double representation of the specified IEEE 754 floating-point value.

longValue

public long longValue()
This method converts the primitive double value represented by this object to a long.
Returns: A long conversion of the double value represented.

toString

public String toString()
This method determines a string representation of the primitive double value for this object.
Returns: A string representing the double value of this object.

toString

public static String toString(double d)
This method determines a string representation of the specified double value.
Parameters: d-the double value to be converted.
Returns: A string representing the specified double value.

valueOf

public static Double valueOf(String s) throws NumberFormatException
This method creates a new double wrapper object based on the double value represented by the specified string.
Parameters: s-the string representation of a double value to be wrapped.
Returns: A double wrapper object representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable double.

Float

Extends: Number
This class implements an object type wrapper for float values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static float MAX_VALUE

This is a constant representing the maximum value allowed for a float. This constant is set to 3.40282346638528860e+38.

public final static float MIN_VALUE

This is a constant representing the minimum value allowed for a float. This constant is set to 1.40129846432481707e-45.

public final static float NaN

This is a constant representing the not-a-number value for float types, which is not equal to anything, including itself.

public final static float NEGATIVE_INFINITY

This is a constant representing negative infinity for float types.

public final static float POSITIVE_INFINITY

This is a constant representing positive infinity for float types.

Float Constructor

public Float(double value)
This constructor creates a float wrapper object representing the specified primitive double value.
Parameters: value-the double value to be wrapped.

Float Constructor

public Float(float value)
This constructor creates a float wrapper object representing the specified primitive float value.
Parameters: value-the float value to be wrapped.

Float Constructor

public Float(String s) throws NumberFormatException
This constructor creates a float wrapper object representing the specified string. The string is converted to a float using a similar technique as the valueOf method.
Parameters: s-the string representation of a float value to be wrapped.
Throws: NumberFormatException if the string does not contain a parsable float.

doubleValue

public double doubleValue()
This method converts the primitive float value represented by this object to a double.
Returns: A double conversion of the float value represented.

equals

public boolean equals(Object obj)
This method compares the float value of the specified object to the float value of this object. The equals method only returns true if the specified object is a Float object representing the same primitive float value as this object. Note that to be useful in hash tables, this method considers two NaN float values to be equal, even though NaN technically is not equal to itself.
Parameters: obj-the object to compare.
Returns: true if the specified object is a Float object representing the same primitive float value as this object; false otherwise.

floatToIntBits

public static int floatToIntBits(float value)
This method determines the IEEE 754 floating-point single precision representation of the specified float value. The IEEE 754 floating-point single precision format specifies the following bit layout:
Parameters: value-the float value to convert to the IEEE 754 format.
Returns: The IEEE 754 floating-point representation of the specified float value.

floatValue

public float floatValue()
This method determines the primitive float value represented by this object.
Returns: The float value represented.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

intBitsToFloat

public static float intBitsToFloat(int bits)
This method determines the float representation of the specified IEEE 754 floating-point single precision value. The IEEE 754 floating-point single precision format specifies the following bit layout:
Parameters: bits-the IEEE 754 floating-point value to convert to a float.
Returns: The float representation of the specified IEEE 754 floating-point value.

intValue

public int intValue()
This method converts the primitive float value represented by this object to an integer.
Returns: An integer conversion of the float value represented.

isInfinite

public boolean isInfinite()
This method determines if the primitive float value represented by this object is positive or negative infinity.
Returns: true if the float value is positive or negative infinity; false otherwise.

isInfinite

public static boolean isInfinite(float v)
This method determines if the specified float value is positive or negative infinity.
Parameters: v-the float value to be checked.
Returns: true if the float value is positive or negative infinity; false otherwise.

isNaN

public boolean isNaN()
This method determines if the primitive float value represented by this object is not a number (NaN).
Returns: true if the float value is not a number; false otherwise.

isNaN

public static boolean isNaN(float v)
This method determines if the specified float value is not a number (NaN).
Parameters: v-the float value to be checked.
Returns: true if the float value is not a number; false otherwise.

longValue

public long longValue()
This method converts the primitive float value represented by this object to a long.
Returns: A long conversion of the float value represented.

toString

public String toString()
This method determines a string representation of the primitive float value for this object.
Returns: A string representing the float value of this object.

toString

public static String toString(float f)
This method determines a string representation of the specified float value.
Parameters: f-the float value to be converted.
Returns: A string representing the specified float value.

valueOf

public static Float valueOf(String s) throws NumberFormatException
This method creates a new float wrapper object based on the float value represented by the specified string.
Parameters: s-the string representation of a float value to be wrapped.
Returns: A float wrapper object representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable float.

Integer

Extends: Number
This class implements an object type wrapper for integer values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static int MAX_VALUE
This is a constant representing the maximum value allowed for an integer. This constant is set to 0x7fffffff.
public final static int MIN_VALUE
This is a constant representing the minimum value allowed for an integer. This constant is set to 0x80000000.

Integer Constructor

public Integer(int value)
This constructor creates an integer wrapper object representing the specified primitive integer value.
Parameters: value-the integer value to be wrapped.

Integer Constructor

public Integer(String s) throws NumberFormatException
This constructor creates an integer wrapper object representing the specified string. The string is converted to an integer using a similar technique as the valueOf method.
Parameters: s-the string representation of an integer value to be wrapped.
Throws: NumberFormatException if the string does not contain a parsable integer.

doubleValue

public double doubleValue()
This method converts the primitive integer value represented by this object to a double.
Returns: A double conversion of the integer value represented.

equals

public boolean equals(Object obj)
This method compares the integer value of the specified object to the integer value of this object. The equals method returns true only if the specified object is an Integer object representing the same primitive integer value as this object.
Parameters: obj-the object to compare.
Returns: true if the specified object is an Integer object representing the same primitive integer value as this object; false otherwise.

floatValue

public float floatValue()
This method converts the primitive integer value represented by this object to a float.
Returns: A float conversion of the integer value represented.

getInteger

public static Integer getInteger(String name)
This method determines an Integer object representing the value of the system property with the specified name. If the system property doesn't exist, null is returned.
Parameters: name-the system property name to check the integer value of.
Returns: An Integer object representing the value of the specified system property, or null if the property doesn't exist.

getInteger

public static Integer getInteger(String name, int val)
This method determines an Integer object representing the value of the system property with the specified name. If the system property doesn't exist, an Integer object representing the specified default property value is returned.
Parameters: name-the system property name to check the integer value of.
Parameters: val-the default integer property value.
Returns: An Integer object representing the value of the specified system property, or an Integer object representing val if the property doesn't exist.

getInteger

public static Integer getInteger(String name, Integer val)
This method determines an Integer object representing the value of the system property with the specified name. In addition, this version of getInteger includes support for reading hexadecimal and octal property values. If the system property doesn't exist, the specified default property value is returned.
Parameters:
name-the system property name to check the integer value of.
val-the default integer property value object.
Returns: An Integer object representing the value of the specified system property, or val if the property doesn't exist.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

intValue

public int intValue()
This method determines the primitive integer value represented by this object.
Returns: The integer value represented.

longValue

public long longValue()
This method converts the primitive integer value represented by this object to a long.
Returns: A long conversion of the integer value represented.

parseInt

public static int parseInt(String s) throws NumberFormatException
This method parses a signed decimal integer value from the specified string. Note that all the characters in the string must be decimal digits, with the exception that the first character can be a minus character (-) to denote a negative number.
Parameters: s-the string representation of an integer value.
Returns: The integer value represented by the specified string.
Throws: NumberFormatException if the string does not contain a parsable integer.

parseInt

public static int parseInt(String s, int radix) throws NumberFormatException
This method parses a signed integer value in the specified radix from the specified string. Note that all the characters in the string must be digits in the specified radix, with the exception that the first character can be a minus character (-) to denote a negative number.
Parameters:
s-the string representation of an integer value.
radix-the radix to use for the integer.
Returns: The integer value represented by the specified string.
Throws: NumberFormatException if the string does not contain a parsable integer.

toBinaryString

public static String toBinaryString(int i)
This method determines a string representation of the specified unsigned base 2 integer value.
Parameters: i-the unsigned base 2 integer value to be converted.
Returns: A string representing the specified unsigned base 2 integer value.

toHexString

public static String toHexString(int i)
This method determines a string representation of the specified unsigned base 16 integer value.
Parameters: i-the unsigned base 16 integer value to be converted.
Returns: A string representing the specified unsigned base 16 integer value.

toOctalString

public static String toOctalString(int i)
This method determines a string representation of the specified unsigned base 8 integer value.
Parameters: i-the unsigned base 8 integer value to be converted.
Returns: A string representing the specified unsigned base 8 integer value.

toString

public String toString()
This method determines a string representation of the primitive decimal integer value for this object.
Returns: A string representing the decimal integer value of this object.

toString

public static String toString(int i)
This method determines a string representation of the specified decimal integer value.
Parameters: i-the decimal integer value to be converted.
Returns: A string representing the specified decimal integer value.

toString

public static String toString(int i, int radix)
This method determines a string representation of the specified integer value in the specified radix.
Parameters:
i-the integer value to be converted.
radix-the radix to use for the conversion.
Returns: A string representing the specified integer value in the specified radix.

valueOf

public static Integer valueOf(String s) throws NumberFormatException
This method creates a new integer wrapper object based on the decimal integer value represented by the specified string.
Parameters: s-the string representation of a decimal integer value to be wrapped.
Returns: An integer wrapper object representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable integer.

valueOf

public static Integer valueOf(String s, int radix) throws NumberFormatException
This method creates a new integer wrapper object based on the integer value in the specified radix represented by the specified string.
Parameters:
s-the string representation of an integer value to be wrapped.
radix-the radix to use for the integer.
Returns: An integer wrapper object in the specified radix representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable integer.

Long

Extends: Number
This class implements an object type wrapper for long values. Object type wrappers are useful because many Java classes operate on objects rather than primitive data types.

Member Constants

public final static int MAX_VALUE

This is a constant representing the maximum value allowed for a long. This constant is set to 0x7fffffffffffffff.

public final static int MIN_VALUE

This is a constant representing the minimum value allowed for a long. This constant is set to 0x8000000000000000.

Long Constructor

public Long(long value)
This constructor creates a long wrapper object representing the specified primitive long value.
Parameters: value-the long value to be wrapped.

Long Constructor

public Long(String s) throws NumberFormatException
This constructor creates a long wrapper object representing the specified string. The string is converted to a long using a similar technique as the valueOf method.
Parameters: s-the string representation of a long value to be wrapped.
Throws: NumberFormatException if the string does not contain a parsable long.

doubleValue

public double doubleValue()
This method converts the primitive long value represented by this object to a double.
Returns: A double conversion of the long value represented.

equals

public boolean equals(Object obj)
This method compares the long value of the specified object to the long value of this object. The equals method returns true only if the specified object is a Long object representing the same primitive long value as this object.
Parameters: obj-the object to compare.
Returns: true if the specified object is a Long object representing the same primitive long value as this object; false otherwise.

floatValue

public float floatValue()
This method converts the primitive long value represented by this object to a float.
Returns: A float conversion of the long value represented.

getLong

public static Long getLong(String name)
This method determines a Long object representing the value of the system property with the specified name. If the system property doesn't exist, null is returned.
Parameters: name-the system property name to check the long value of.
Returns: A Long object representing the value of the specified system property, or null if the property doesn't exist.

getLong

public static Long getLong(String name, long val)
This method determines a Long object representing the value of the system property with the specified name. If the system property doesn't exist, a Long object representing the specified default property value is returned.
Parameters: name-the system property name to check the long value of.
Parameters: val-the default long property value.
Returns: A Long object representing the value of the specified system property, or a long object representing val if the property doesn't exist.

getLong

public static Long getLong(String name, Long val)
This method determines a Long object representing the value of the system property with the specified name. In addition, this version of getLong includes support for reading hexadecimal and octal property values. If the system property doesn't exist, the specified default property value is returned.
Parameters:
name-the system property name to check the long value of.
val-the default long property value object.
Returns: A Long object representing the value of the specified system property, or val if the property doesn't exist.

hashCode

public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.

intValue

public int intValue()
This method converts the primitive long value represented by this object to an integer.
Returns: An integer conversion of the long value represented.

longValue

public long longValue()
This method determines the primitive long value represented by this object.
Returns: The long value represented.

parseLong

public static long parseLong(String s) throws NumberFormatException
This method parses a signed decimal long value from the specified string. Note that all the characters in the string must be decimal digits, with the exception that the first character can be a minus character (-) to denote a negative number.
Parameters: s-the string representation of a long value.
Returns: The long value represented by the specified string.
Throws: NumberFormatException if the string does not contain a parsable long.

parseLong

public static long parseLong(String s, int radix) throws NumberFormatException
This method parses a signed long value in the specified radix from the specified string. Note that all the characters in the string must be digits in the specified radix, with the exception that the first character can be a minus character (-) to denote a negative number.
Parameters:
s-the string representation of a long value.
radix-the radix to use for the long.
Returns: The long value represented by the specified string.
Throws: NumberFormatException if the string does not contain a parsable long.

toBinaryString

public static String toBinaryString(long l)
This method determines a string representation of the specified unsigned base 2 long value.
Parameters: l-the unsigned base 2 long value to be converted.
Returns: A string representing the specified unsigned base 2 long value.

toHexString

public static String toHexString(long l)
This method determines a string representation of the specified unsigned base 16 long value.
Parameters: l-the unsigned base 16 long value to be converted.
Returns: A string representing the specified unsigned base 16 long value.

toOctalString

public static String toOctalString(long l)
This method determines a string representation of the specified unsigned base 8 long value.
Parameters: l-the unsigned base 8 long value to be converted.
Returns: A string representing the specified unsigned base 8 long value.

toString

public String toString()
This method determines a string representation of the primitive decimal long value for this object.
Returns: A string representing the decimal long value of this object.

toString

public static String toString(long l)
This method determines a string representation of the specified decimal long value.
Parameters: l-the decimal long value to be converted.
Returns: A string representing the specified decimal long value.

toString

public static String toString(long l, int radix)
This method determines a string representation of the specified long value in the specified radix.
Parameters:
i-the long value to be converted.
radix-the radix to use for the conversion.
Returns: A string representing the specified long value in the specified radix.

valueOf

public static Long valueOf(String s) throws NumberFormatException
This method creates a new long wrapper object based on the decimal long value represented by the specified string.
Parameters: s-the string representation of a decimal long value to be wrapped.
Returns: A long wrapper object representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable long.

valueOf

public static Long valueOf(String s, int radix) throws NumberFormatException
This method creates a new long wrapper object based on the long value in the specified radix represented by the specified string.
Parameters:
s-the string representation of a long value to be wrapped.
radix-the radix to use for the long.
Returns: A long wrapper object in the specified radix representing the specified string.
Throws: NumberFormatException if the string does not contain a parsable long.

Math

Extends: Object
This class implements a library of common math functions, including methods for performing basic numerical operations such as elementary exponential, logarithm, square root, and trigonometric functions.

Member Constants

public final static double E

This is a constant representing the double value of E, which is the base of the natural logarithms. This constant is set to 2.7182818284590452354.

public final static double PI

This is a constant representing the double value of PI, which is the ratio of the circumference of a circle to its diameter. This constant is set to 3.14159265358979323846.

abs

public static double abs(double a)
This method calculates the absolute value of the specified double value.
Parameters: a-the double value to calculate the absolute value of.
Returns: The absolute value of the double value.

abs

public static float abs(float a)
This method calculates the absolute value of the specified float value.
Parameters: a-the float value to calculate the absolute value of.
Returns: The absolute value of the float value.

abs

public static int abs(int a)
This method calculates the absolute value of the specified integer value.
Parameters: a-the integer value to calculate the absolute value of.
Returns: The absolute value of the integer value.

abs

public static long abs(long a)
This method calculates the absolute value of the specified long value.
Parameters: a-the long value to calculate the absolute value of.
Returns: The absolute value of the long value.

acos

public static double acos(double a)
This method calculates the arc cosine of the specified double value.
Parameters: a-the double value to calculate the arc cosine of.
Returns: The arc cosine of the double value.

asin

public static double asin(double a)
This method calculates the arc sine of the specified double value.
Parameters: a-the double value to calculate the arc sine of.
Returns: The arc sine of the double value.

atan

public static double atan(double a)
This method calculates the arc tangent of the specified double value.
Parameters: a-the double value to calculate the arc tangent of.
Returns: The arc tangent of the double value.

atan2

public static double atan2(double x, double y)
This method calculates the theta component of the polar coordinate (r,theta) corresponding to the rectangular coordinate (x y) specified by the double values.
Parameters:
x-the x component value of the rectangular coordinate.
y-the y component value of the rectangular coordinate.
Returns: The theta component of the polar coordinate corresponding to the rectangular coordinate specified by the double values.

ceil

public static double ceil(double a)
This method determines the smallest double whole number that is greater than or equal to the specified double value.
Parameters: a-the double value to calculate the ceiling of.
Returns: The smallest double whole number that is greater than or equal to the specified double value.

cos

public static double cos(double a)
This method calculates the cosine of the specified double value, which is specified in radians.
Parameters: a-the double value to calculate the cosine of, in radians.
Returns: The cosine of the double value.

exp

public static double exp(double a)
This method calculates the exponential value of the specified double value, which is E raised to the power of a.
Parameters: a-the double value to calculate the exponential value of.
Returns: The exponential value of the specified double value.

floor

public static double floor(double a)
This method determines the largest double whole number that is less than or equal to the specified double value.
Parameters: a-the double value to calculate the floor of.
Returns: The largest double whole number that is less than or equal to the specified double value.

IEEEremainder

public static double IEEEremainder(double f1, double f2)
This method calculates the remainder of f1 divided by f2 as defined by the IEEE 754 standard.
Parameters:
f1-the dividend for the division operation.
f2-the divisor for the division operation.
Returns: The remainder of f1 divided by f2 as defined by the IEEE 754 standard.

log

public static double log(double a) throws ArithmeticException
This method calculates the natural logarithm (base E) of the specified double value.
Parameters: a-the double value, which is greater than 0.0, to calculate the natural logarithm of.
Returns: The natural logarithm of the specified double value.