CHAPTER 20
The java.lang package contains classes that are fundamental to the design of
the Java language. The most important classes are Object, which is the root of the
class hierarchy, and Class, instances of which represent classes at run time.
Frequently it is necessary to represent a value of primitive type as if it were an object. The wrapper classes Boolean, Character, Integer, Long, Float, and Double serve this purpose. An object of type Double, for example, contains a field whose type is double, representing that value in such a way that a reference to it can be stored in a variable of reference type. These classes also provide a number of methods for converting among primitive values, as well as supporting such standard methods as equals and hashCode.
The class Math provides commonly used mathematical functions such as sine, cosine, and square root. The classes String and StringBuffer similarly provide commonly used operations on character strings.
Classes ClassLoader, Process, Runtime, SecurityManager, and System provide "system operations" that manage the dynamic loading of classes, creation of external processes, host environment inquiries such as the time of day, and enforcement of security policies.
Class Throwable encompasses objects that may be thrown by the throw statement (§14.16). Subclasses of Throwable represent errors and exceptions.
The hierarchy of classes defined in package java.lang is as follows.
Object§20.1interfaceCloneable§20.2Class§20.3Boolean§20.4Character§20.5Number§20.6Integer§20.7Long§20.8Float§20.9Double§20.10Math§20.11String§20.12StringBuffer§20.13ClassLoader§20.14Process§20.15Runtime§20.16SecurityManager§20.17System§20.18interfaceRunnable§20.19Thread§20.20ThreadGroup§20.21Throwable§20.22ErrorLinkageErrorClassCircularityErrorClassFormatErrorExceptionInInitializerErrorIncompatibleClassChangeErrorAbstractMethodErrorIllegalAccessErrorInstantiationErrorNoSuchFieldErrorNoSuchMethodErrorNoClassDefFoundErrorUnsatisfiedLinkErrorVerifyErrorVirtualMachineErrorInternalErrorOutOfMemoryErrorStackOverflowErrorUnknownErrorThreadDeathExceptionClassNotFoundExceptionCloneNotSupportedExceptionIllegalAccessExceptionInstantiationExceptionInterruptedExceptionRuntimeExceptionArithmeticExceptionArrayStoreExceptionClassCastExceptionIllegalArgumentExceptionIllegalThreadStateExceptionNumberFormatExceptionIllegalMonitorStateExceptionIndexOutOfBoundsExceptionNegativeArraySizeExceptionNullPointerExceptionSecurityException
java.lang.ObjectObject is the single root of the class hierarchy. All objects, including
arrays, implement the methods of this class.
public classObject{ public final ClassgetClass(); public StringtoString(); public booleanequals(Object obj); public inthashCode(); protected Objectclone() throws CloneNotSupportedException; public final voidwait()
throws IllegalMonitorStateException,
InterruptedException; public final voidwait(long millis)
throws IllegalMonitorStateException,
InterruptedException; public final voidwait(long millis, int nanos)
throws IllegalMonitorStateException, InterruptedException; public final voidnotify() throws IllegalMonitorStateException; public final voidnotifyAll() throws IllegalMonitorStateException; protected voidfinalize()
throws Throwable; }
20.1.1 public final Class
getClass()
This method returns a reference to the unique object of type Class (§20.3) that
represents the class of this object. That Class object is the object that is locked by
static synchronized methods of the represented class.
20.1.2 public String
toString()
The general contract of toString is that it returns a string that "textually represents" this object. The idea is to provide a concise but informative representation
that will be useful to a person reading it.
The toString method defined by class Object returns a string consisting of the name of the class of which the object is an instance, a commercial at character '@', and the unsigned hexadecimal representation of the hashcode of the object. In other words, this method returns a string equal to the value of:
getClass().getName() +Overridden by'@'+ Integer.toHexString(hashCode())
Class (§20.3), Boolean (§20.4), Character (§20.5), Integer (§20.7), Long (§20.8), Float (§20.9), Double (§20.10), String (§20.12), StringBuffer (§20.13), Thread (§20.20), ThreadGroup (§20.21), Throwable (§20.22.4), and Bitset (§21.2).20.1.3 public boolean
equals(Object obj)
This method indicates whether some other object is "equal to" this one.
The general contract of equals is that it implements an equivalence relation:
x, x.equals(x) should return true.
x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used by x and y in equals comparisons is modified.
x, x.equals(null) should return false.
equals method defined by class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, ((Object)x).equals(y) returns true if and only if x and y refer to the same object.
Overridden by Boolean (§20.4), Character (§20.5), Integer (§20.7), Long (§20.8), Float (§20.9), Double (§20.10), String (§20.12), and Bitset (§21.2).
20.1.4 public int
hashCode()
This method is supported principally for the benefit of hash tables such as those
provided by the Java library class java.util.Hashtable (§21.5).
The general contract of hashCode is as follows:
hashCode must consistently return the same integer. The integer may be positive, negative, or zero. This integer does not, however, have to remain consistent from one Java application to another, or from one execution of an application to another execution of the same application.
equals method (§20.1.3), then calling the hashCode method on each of the two objects must produce the same integer result.
equals method (§20.1.3), then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.
hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java language.)
Overridden by Boolean (§20.4), Character (§20.5), Integer (§20.7), Long (§20.8), Float (§20.9), Double (§20.10), String (§20.12), and Bitset (§21.2).
20.1.5 protected Object
clone()
throws CloneNotSupportedException
The general contract of clone is that it creates and returns a copy of this object.
The precise meaning of "copy" may depend on the class of the object. The general
intent is that, for any object x, the expression:
x.clone() != xwill be
true, and that the expression:
x.clone.getClass() == x.getClass()will be
true, but these are not absolute requirements. While it is typically the case
that:
x.clone.equals(x)will be
true, this is not an absolute requirement. Copying an object will typically
entail creating a new instance of its class, but it also may require copying of internal data structures as well.
The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time. The clone method is implemented by the class Object as a convenient, general utility for subclasses that implement the interface Cloneable, possibly also overriding the clone method, in which case the overriding definition can refer to this utility definition by the call:
super.clone()
20.1.6 public final void
wait()
throws IllegalMonitorStateException, InterruptedException
This method causes the current thread to wait until some other thread invokes the
notify method (§20.1.9) or the notifyAll method (§20.1.10) for this object.
In other words, this method behaves exactly as if it simply performs the call wait(0) (§20.1.7).
20.1.7 public final void
wait(long millis)
throws IllegalMonitorStateException, InterruptedException
This method causes the current thread to wait until either some other thread
invokes the notify method (§20.1.9) or the notifyAll method (§20.1.10) for
this object, or a certain amount of real time has elapsed.
This method may be called only when the current thread is already synchronized on this object. If the current thread does not own the lock on this object, an IllegalMonitorStateException is thrown.
This method causes the current thread (call it T) to place itself in the wait set (§17.14) for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
notify method for this object and thread T happens to be arbitrarily chosen as the thread to be awakened.
notifyAll method for this object.
millis. If millis is zero, however, then real time is not taken into consideration and the thread simply waits until notified.
wait method was invoked. Thread T then
returns from the invocation of the wait method. Thus, on return from the wait
method, the synchronization state of the object and of thread T is exactly as it was
when the wait method was invoked.
If the current thread is interrupted (§20.20.31) by another thread while it is waiting, then an InterruptedException is thrown. This exception is not thrown until the lock status of this object has been restored as described above.
Note that the wait method, as it places the current thread into the wait set for this object, unlocks only this object; any other objects on which the current thread may be synchronized remain locked while the thread waits.
20.1.8 public final void
wait(long millis, int nanos)
throws IllegalMonitorStateException, InterruptedException
This method causes the current thread to wait until either some other thread
invokes the notify method (§20.1.9) or the notifyAll method (§20.1.10) for
this object, or some other thread interrupts the current thread, or a certain amount
of real time has elapsed.
The amount of real time, measured in nanoseconds, is given by:
1000000*millis+nanos
In all other respects, this method does the same thing as the method wait of one
argument (§20.1.7). In particular, wait(0, 0) means the same thing as wait(0).
20.1.9 public final void
notify()
throws IllegalMonitorStateException
If any threads are waiting (§20.1.7) on this object, one of them is chosen to be awakened. The choice is arbitrary and at the discretion of the implementation.
The notify method may be called only when the current thread is already synchronized on this object. If the current thread does not own the lock on this object, an IllegalMonitorStateException is thrown.
The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.
20.1.10 public final void
notifyAll()
throws IllegalMonitorStateException
All the threads waiting (§20.1.7) on this object are awakened.
The notifyAll method may be called only when the current thread is already synchronized on this object. If the current thread does not own the lock on this object, an IllegalMonitorStateException is thrown.
The awakened threads will not be able to proceed until the current thread relinquishes the lock on this object. The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object.
20.1.11 protected void
finalize() throws Throwable
The general contract of finalize is that it is invoked if and when the Java Virtual
Machine has determined that there is no longer any means by which this object
can be accessed by any thread that has not yet died (§12.7), except as a result of an
action taken by the finalization of some other object or class which is ready to be
finalized. The finalize method may take any action, including making this
object available again to other threads; the usual purpose of finalize, however,
is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection
might perform explicit I/O transactions to break the connection before the object
is permanently discarded.
The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.
Java does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.
After the finalize method has been invoked for an object, no further action is taken until the Java Virtual Machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.
The finalize method is never invoked more than once by a Java Virtual Machine for any given object.
java.lang.CloneableCloneable interface should be implemented by any class that is intended to
support or override the method clone (§20.1.5).
public interface Cloneable { }
The interface Cloneable declares no methods.
java.lang.ClassClass represent classes and interfaces in a way that can be
manipulated by a running Java program. Every array also belongs to a class represented by a Class object that is shared among all arrays with the same element
type and number of dimensions.
There is no public constructor for the class Class. The Java Virtual Machine automatically constructs Class objects as classes are loaded; such objects cannot be created by user programs.
public final classClass{ public StringtoString(); public StringgetName(); public booleanisInterface(); public ClassgetSuperclass(); public Class[]getInterfaces(); public ObjectnewInstance() throws InstantiationException, IllegalAccessException; public ClassLoadergetClassLoader(); public static ClassforName(String className)
throws ClassNotFoundException; }
20.3.1 public String
toString()
If this Class object represents a class (which may be a declared class or an array
class), a string is returned consisting of the word class, a space, and the name of
the class as returned by the getName method (§20.3.2). If this Class object represents an interface, a string is returned consisting of the word interface, a space,
and the name of the interface as returned by the getName method.
In other words, this method returns a string equal to the value of:
(isInterface() ? "interface " : "class ") + getName()Overrides the
toString method of Object (§20.1.2).20.3.2 public String
getName()
The fully qualified name of the class or interface represented by this Class object
is returned as a String. For example:
new Object().getClass().getName()
returns "java.lang.Object".
If this class object represents a class of arrays, then the name consists of the name of the element type in Java signature format, preceded by one or more "[" characters representing the depth of array nesting. For example:
(new Object[3]).getClass().getName()
returns "[Ljava.lang.Object;" and:
(new int[3][4][5][6][7][8][9]).getClass().getName()
returns "[[[[[[[I". The encoding of element type names is as follows:
B byte C char D double F float I int J long Lclassname; class or interface S short Z booleanA class or interface name classname is given in fully qualified form as shown in the example above. For a full description of type descriptors see the chapter on the format of class files in the Java Virtual Machine Specification.
20.3.3 public boolean
isInterface()
If this Class object represents an interface, true is returned. If this Class object
represents a class, false is returned.
20.3.4 public Class
getSuperclass()
If this Class object represents any class other than the class Object, then the
Class that represents the superclass of that class is returned. If this Class object
is the one that represents the class Object, or if it represents an interface, null is
returned. If this Class object represents an array class, then the Class that represents class Object is returned.
20.3.5 public Class[]
getInterfaces()
This method returns an array of objects that represent interfaces. The array may be empty.
If this Class object represents a class, the array contains objects representing all interfaces directly implemented by the class. The order of the interface objects in the array corresponds to the order of the interface names in the implements clause of the declaration of the class represented by this Class object. For example, given the class declaration:
class Shimmer implements FloorWax, DessertTopping { ... }
suppose the value of s is an instance of Shimmer; the value of the expression:
s.getClass().getInterfaces()[0]is the
Class object that represents interface FloorWax; and the value of:
s.getClass().getInterfaces()[1]is the
Class object that represents interface DessertTopping.
If this Class object represents an interface, the array contains objects representing all interfaces directly extended by the interface-that is, the immediate superinterfaces of the interface. The order of the interface objects in the array corresponds to the order of the interface names in the extends clause of the declaration of the interface represented by this Class object.
20.3.6 public Object
newInstance()
throws InstantiationException, IllegalAccessException
This method creates and returns a new instance of the class represented by this
Class object. This is done exactly as if by a class instance creation expression
(§15.8) with an empty argument list; for example, if t is the Class object that represents class Thread, then t.newInstance() does exactly the same thing as new
Thread(). If evaluation of such a class instance creation expression would complete abruptly, then the call to the newInstance method will complete abruptly
for the same reason. See also §11.5.1.2 for more on InstantiationException.
20.3.7 public ClassLoader
getClassLoader()
This method returns a reference to the class loader (§20.14) that loaded this class.
If this class has no class loader, then null is returned.
20.3.8 public static Class
forName(String className)
throws ClassNotFoundException
Given the fully-qualified name of a class, this method attempts to locate, load, and
link the class (§12.2). If it succeeds, then a reference to the Class object for the
class is returned. If it fails, then a ClassNotFoundException is thrown.
java.lang.BooleanBoolean represent primitive values of type boolean.
public final classBoolean{ public static final BooleanTRUE= new Boolean(true); public static final BooleanFALSE= new Boolean(false); publicBoolean(boolean value); publicBoolean(String s); public StringtoString(); public booleanequals(Object obj); public inthashCode(); public booleanbooleanValue(); public static BooleanvalueOf(String s); public static booleangetBoolean(String name); }
20.4.1 public static final Boolean
TRUE = new Boolean(true);
The constant value of this field is a Boolean object corresponding to the primitive
value true.
20.4.2 public static final Boolean
FALSE = new Boolean(false);
The constant value of this field is a Boolean object corresponding to the primitive
value false.
20.4.3 public
Boolean(boolean value)
This constructor initializes a newly created Boolean object so that it represents
the primitive value that is the argument.
20.4.4 public
Boolean(String s)
This constructor initializes a newly created Boolean object so that it represents
true if and only if the argument is not null and is equal, ignoring case, to the
string "true".
newBoolean("True")produces aBooleanobject that representstrue.newBoolean("yes")produces aBooleanobject that representsfalse.
20.4.5 public String
toString()
If this Boolean object represents true, a string equal to "true" is returned. If
this Boolean object represents false, a string equal to "false" is returned.
Overrides the toString method of Object (§20.1.2).
20.4.6 public boolean
equals(Object obj)
The result is true if and only if the argument is not null and is a Boolean object
that represents the same boolean value as this Boolean object.
Overrides the equals method of Object (§20.1.3).
20.4.7 public int
hashCode()
If this Boolean object represents true, the integer 1231 is returned. If this
Boolean object represents false, the integer 1237 is returned.
Overrides the hashCode method of Object (§20.1.4).
20.4.8 public boolean
booleanValue()
The primitive boolean value represented by this Boolean object is returned.
20.4.9 public static boolean
valueOf(String s)
The result is true if and only if the argument is not null and is equal, ignoring
case, to the string "true".
Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false.
20.4.10 public static boolean
getBoolean(String name)
The result is true if and only if the value of the system property (§20.18.9) named
by the argument is equal, ignoring case, to the string "true".
java.lang.CharacterCharacter represent primitive values of type char.
public final classMany of the methods of classCharacter{ public static final charMIN_VALUE= '\u0000'; public static final charMAX_VALUE= '\uffff'; public static final intMIN_RADIX= 2; public static final intMAX_RADIX= 36; publicCharacter(char value); public StringtoString(); public booleanequals(Object obj); public inthashCode(); public charcharValue(); public static booleanisDefined(char ch); public static booleanisLowerCase(char ch); public static booleanisUpperCase(char ch); public static booleanisTitleCase(char ch); public static booleanisDigit(char ch); public static booleanisLetter(char ch); public static booleanisLetterOrDigit(char ch); public static booleanisJavaLetter(char ch); public static booleanisJavaLetterOrDigit(char ch);) public static booleanisSpace(char ch); public static chartoLowerCase(char ch); public static chartoUpperCase(char ch); public static chartoTitleCase(char ch); public static intdigit(char ch, int radix); public static charforDigit(int digit, int radix); }
Character are defined in terms of a "Unicode attribute table" that specifies a name for every defined Unicode character as well as other possible attributes, such as a decimal value, an uppercase equivalent, a lowercase equivalent, and/or a titlecase equivalent. Prior to Java 1.1, these methods were internal to the Java compiler and based on Unicode 1.1.5, as described here. The most recent versions of these methods should be used in Java compilers that are to run on Java systems that do not yet include these methods.The Unicode 1.1.5 attribute table is available on the World Wide Web as:
ftp://unicode.org/pub/MappingTables/UnicodeData-1.1.5.txtHowever, this file contains a few errors. The term "Unicode attribute table" in the following sections refers to the contents of this file after the following corrections have been applied:
03D0;GREEK BETA SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER CURLED BETA;;0392;;0392
03D1;GREEK THETA SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398
03D5;GREEK PHI SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER SCRIPT PHI;;03A6;;03A6
03D6;GREEK PI SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER OMEGA PI;;03A0;;03A0
03F0;GREEK KAPPA SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER SCRIPT KAPPA;;039A;;039A
03F1;GREEK RHO SYMBOL;Ll;0;L;;;;;N;GREEK SMALL LETTER TAILED RHO;;03A1;;03A1
FF10;FULLWIDTH DIGIT ZERO;Nd;0;EN;0030;0;0;0;N;;;;;
FF11;FULLWIDTH DIGIT ONE;Nd;0;EN;0031;1;1;1;N;;;;;
FF12;FULLWIDTH DIGIT TWO;Nd;0;EN;0032;2;2;2;N;;;;;
FF13;FULLWIDTH DIGIT THREE;Nd;0;EN;0033;3;3;3;N;;;;;
FF14;FULLWIDTH DIGIT FOUR;Nd;0;EN;0034;4;4;4;N;;;;;
FF15;FULLWIDTH DIGIT FIVE;Nd;0;EN;0035;5;5;5;N;;;;;
FF16;FULLWIDTH DIGIT SIX;Nd;0;EN;0036;6;6;6;N;;;;;
FF17;FULLWIDTH DIGIT SEVEN;Nd;0;EN;0037;7;7;7;N;;;;;
FF18;FULLWIDTH DIGIT EIGHT;Nd;0;EN;0038;8;8;8;N;;;;;
FF19;FULLWIDTH DIGIT NINE;Nd;0;EN;0039;9;9;9;N;;;;;
03DA;GREEK LETTER STIGMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER STIGMA;;;;
03DC;GREEK LETTER DIGAMMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER DIGAMMA;;;;
03DE;GREEK LETTER KOPPA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER KOPPA;;;;
03E0;GREEK LETTER SAMPI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SAMPI;;;;
03C2;GREEK SMALL LETTER FINAL SIGMA;Ll;0;L;;;;;N;;;03A3;;03A3
Java 1.1 will include the methods defined here, either based on Unicode 1.1.5 or, we hope, updated versions of the methods that use the newer Unicode 2.0. The character attribute table for Unicode 2.0 is currently available on the World Wide Web as the file:
ftp://unicode.org/pub/MappingTables/UnicodeData-2.0.12.txtIf you are implementing a Java compiler or system, please refer to the page:
http://java.sun.com/Serieswhich will be updated with information about the Unicode-dependent methods.
The biggest change in Unicode 2.0 is a complete rearrangement of the Korean Hangul characters. There are numerous smaller improvements as well.
It is our intention that Java will track Unicode as it evolves over time. Given that full Unicode support is just emerging in the marketplace, and that changes in Unicode are in areas which are not yet widely used, this should cause minimal problems and further Java's goal of worldwide language support.
20.5.1 public static final char
MIN_VALUE = '\u0000';
The constant value of this field is the smallest value of type char.
[This field is scheduled for introduction in Java version 1.1.]
20.5.2 public static final char
MAX_VALUE = '\uffff';
The constant value of this field is the smallest value of type char.
[This field is scheduled for introduction in Java version 1.1.]
20.5.3 public static final int
MIN_RADIX = 2;
The constant value of this field is the smallest value permitted for the radix argument in radix-conversion methods such as the digit method (§20.5.23), the
forDigit method (§20.5.24), and the toString method of class Integer
(§20.7).
20.5.4 public static final int
MAX_RADIX = 36;
The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method (§20.5.23), the forDigit method (§20.5.24), and the toString method of class Integer (§20.7).
20.5.5 public
Character(char value)
This constructor initializes a newly created Character object so that it represents
the primitive value that is the argument.
20.5.6 public String
toString()
The result is a String whose length is 1 and whose sole component is the primitive char value represented by this Character object.
Overrides the toString method of Object (§20.1.2).
20.5.7 public boolean
equals(Object obj)
The result is true if and only if the argument is not null and is a Character
object that represents the same char value as this Character object.
Overrides the equals method of Object (§20.1.3).
20.5.8 public int
hashCode()
The result is the primitive char value represented by this Character object, cast
to type int.
Overrides the hashCode method of Object (§20.1.4).
20.5.9 public char
charValue()
The primitive char value represented by this Character object is returned.
20.5.10 public static boolean
isDefined(char ch)
The result is true if and only if the character argument is a defined Unicode character.
A character is a defined Unicode character if and only if at least one of the following is true:
\u3040 and not greater than \u9FA5.
\uF900 and not greater than \uFA2D.
0000-01F5, 01FA-0217, 0250-02A8, 02B0-02DE, 02E0-02E9, 0300-0345, 0360-0361, 0374-0375, 037A, 037E, 0384-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6, 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 0401-040C, 040E-044F, 0451-045C, 045E-0486, 0490-04C4, 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9, 0531-0556, 0559-055F, 0561-0587, 0589, 05B0-05B9, 05BB-05C3, 05D0-05EA, 05F0-05F4, 060C, 061B, 061F, 0621-063A, 0640-0652, 0660-066D, 0670-06B7, 06BA-06BE, 06C0-06CE, 06D0-06ED, 06F0-06F9, 0901-0903, 0905-0939, 093C-094D, 0950-0954, 0958-0970, 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0, 09B2, 09B6-09B9, 09BC, 09BE-09C4, 09C7-09C8, 09CB-09CD, 09D7, 09DC-09DD, 09DF-09E3, 09E6-09FA, 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30, 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3C, 0A3E-0A42, 0A47-0A48, 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A66-0A74, 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8, 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABC-0AC5, 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0, 0AE6-0AEF, 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30, 0B32-0B33, 0B36-0B39, 0B3C-0B43, 0B47-0B48, 0B4B-0B4D, 0B56-0B57, 0B5C-0B5D, 0B5F-0B61, 0B66-0B70, 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A, 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5, 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD, 0BD7, 0BE7-0BF2, 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33, 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C55-0C56, 0C60-0C61, 0C66-0C6F, 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3, 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CD5-0CD6, 0CDE, 0CE0-0CE1, 0CE6-0CEF, 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39, 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D57, 0D60-0D61, 0D66-0D6F, 0E01-0E3A, 0E3F-0E5B, 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97, 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB, 0EAD-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6, 0EC8-0ECD, 0ED0-0ED9, 0EDC-0EDD, 10A0-10C5, 10D0-10F6, 10FB, 1100-1159, 115F-11A2, 11A8-11F9, 1E00-1E9A, 1EA0-1EF9, 1F00-1F15, 1F18-1F1D, 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D, 1F5F-1F7D, 1F80-1FB4, 1FB6-1FC4, 1FC6-1FD3, 1FD6-1FDB, 1FDD-1FEF, 1FF2-1FF4, 1FF6-1FFE, 2000-202E, 2030-2046, 206A-2070, 2074-208E, 20A0-20AA, 20D0-20E1, 2100-2138, 2153-2182, 2190-21EA, 2200-22F1, 2300, 2302-237A, 2400-2424, 2440-244A, 2460-24EA, 2500-2595, 25A0-25EF, 2600-2613, 261A-266F, 2701-2704, 2706-2709, 270C-2727, 2729-274B, 274D, 274F-2752, 2756, 2758-275E, 2761-2767, 2776-2794, 2798-27AF, 27B1-27BE, 3000-3037, 303F, 3041-3094, 3099-309E, 30A1-30FE, 3105-312C, 3131-318E, 3190-319F, 3200-321C, 3220-3243, 3260-327B, 327F-32B0, 32C0-32CB, 32D0-32FE, 3300-3376, 337B-33DD, 33E0-33FE, 3400-9FA5, F900-FA2D, FB00-FB06, FB13-FB17, FB1E-FB36, FB38-FB3C, FB3E, FB40-FB41, FB43-FB44, FB46-FBB1, FBD3-FD3F, FD50-FD8F, FD92-FDC7, FDF0-FDFB, FE20-FE23, FE30-FE44, FE49-FE52, FE54-FE66, FE68-FE6B, FE70-FE72, FE74, FE76-FEFC, FEFF, FF01-FF5E, FF61-FFBE, FFC2-FFC7, FFCA-FFCF, FFD2-FFD7, FFDA-FFDC, FFE0-FFE6, FFE8-FFEE, FFFD.[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.11 public static boolean
isLowerCase(char ch)
The result is true if and only if the character argument is a lowercase character.
A character is considered to be lowercase if and only if all of the following are true:
ch is not in the range \u2000 through \u2FFF.
0061-007A, 00DF-00F6, 00F8-00FF, 0101-0137 (odds only), 0138-0148 (evens only), 0149-0177 (odds only), 017A-017E (evens only), 017F-0180, 0183, 0185, 0188, 018C-018D, 0192, 0195, 0199-019B, 019E, 01A1-01A5 (odds only), 01A8, 01AB, 01AD, 01B0, 01B4, 01B6, 01B9-01BA, 01BD, 01C6, 01C9, 01CC-01DC (evens only), 01DD-01EF (odds only), 01F0, 01F3, 01F5, 01FB-0217 (odds only), 0250-0261, 0263-0269, 026B-0273, 0275, 0277-027F, 0282-028E, 0290-0293, 029A, 029D-029E, 02A0, 02A3-02A8, 0390, 03AC-03CE, 03D0-03D1, 03D5-03D6, 03E3-03EF (odds only), 03F0-03F1, 0430-044F, 0451-045C, 045E-045F, 0461-0481 (odds only), 0491-04BF (odds only), 04C2, 04C4, 04C8, 04CC, 04D1-04EB (odds only), 04EF-04F5 (odds only), 04F9, 0561-0587, 1E01-1E95 (odds only), 1E96-1E9A, 1EA1-1EF9 (odds only), 1F00-1F07, 1F10-1F15, 1F20-1F27, 1F30-1F37, 1F40-1F45, 1F50-1F57, 1F60-1F67, 1F70-1F7D, 1F80-1F87, 1F90-1F97, 1FA0-1FA7, 1FB0-1FB4, 1FB6-1FB7, 1FC2-1FC4, 1FC6-1FC7, 1FD0-1FD3, 1FD6-1FD7, 1FE0-1FE7, 1FF2-1FF4, 1FF6-1FF7, FB00-FB06, FB13-FB17, FF41-FF5A.Of the first 128 Unicode characters, exactly 26 are considered to be lowercase:
abcdefghijklmnopqrstuvwxyz[This specification for the method
isLowerCase is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns false for all arguments larger than \u00FF.]20.5.12 public static boolean
isUpperCase(char ch)
The result is true if and only if the character argument is an uppercase character.
A character is considered to be uppercase if and only if all of the following are true:
ch is not in the range \u2000 through \u2FFF.
0041-005A, 00C0-00D6, 00D8-00DE, 0100-0136 (evens only), 0139-0147 (odds only), 014A-0178 (evens only), 0179-017D (odds only), 0181-0182, 0184, 0186, 0187, 0189-018B, 018E-0191, 0193-0194, 0196-0198, 019C-019D, 019F-01A0, 01A2, 01A4, 01A7, 01A9, 01AC, 01AE, 01AF, 01B1-01B3, 01B5, 01B7, 01B8, 01BC, 01C4, 01C7, 01CA, 01CD-01DB (odds only), 01DE-01EE (evens only), 01F1, 01F4, 01FA-0216 (evens only), 0386, 0388-038A, 038C, 038E, 038F, 0391-03A1, 03A3-03AB, 03E2-03EE (evens only), 0401-040C, 040E-042F, 0460-0480 (evens only), 0490-04BE (evens only), 04C1, 04C3, 04C7, 04CB, 04D0-04EA (evens only), 04EE-04F4 (evens only), 04F8, 0531-0556, 10A0-10C5, 1E00-1E94 (evens only), 1EA0-1EF8 (evens only), 1F08-1F0F, 1F18-1F1D, 1F28-1F2F, 1F38-1F3F, 1F48-1F4D, 1F59-1F5F (odds only), 1F68-1F6F, 1F88-1F8F, 1F98-1F9F, 1FA8-1FAF, 1FB8-1FBC, 1FC8-1FCC, 1FD8-1FDB, 1FE8-1FEC, 1FF8-1FFC, FF21-FF3A.Of the first 128 Unicode characters, exactly 26 are considered to be uppercase:
ABCDEFGHIJKLMNOPQRSTUVWXYZ[This specification for the method
isUpperCase is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns false for all arguments larger than \u00FF.]20.5.13 public static boolean
isTitleCase(char ch)
The result is true if and only if the character argument is a titlecase character.
The notion of "titlecase" was introduced into Unicode to handle a peculiar situation: there are single Unicode characters whose appearance in each case looks exactly like two ordinary Latin letters. For example, there is a single Unicode character `LJ' (\u01C7) that looks just like the characters `L' and `J' put together. There is a corresponding lowercase letter `lj' (\u01C9) as well. These characters are present in Unicode primarily to allow one-to-one translations from the Cyrillic alphabet, as used in Serbia, for example, to the Latin alphabet. Now suppose the word "LJUBINJE" (which has six characters, not eight, because two of them are the single Unicode characters `LJ' and `NJ', perhaps produced by one-to-one translation from the Cyrillic) is to be written as part of a book title, in capitals and lowercase. The strategy of making the first letter uppercase and the rest lowercase results in "LJubinje"-most unfortunate. The solution is that there must be a third form, called a titlecase form. The titlecase form of `LJ' is `Lj' (\u01C8) and the titlecase form of `NJ' is `Nj'. A word for a book title is then best rendered by converting the first letter to titlecase if possible, otherwise to uppercase; the remaining letters are then converted to lowercase.
A character is considered to be titlecase if and only if both of the following are true:
ch is not in the range \u2000 through \u2FFF.
isTitleCase returns
true:
\u01C5 LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON \u01C8 LATIN CAPITAL LETTER L WITH SMALL LETTER J \u01CB LATIN CAPITAL LETTER N WITH SMALL LETTER J \u01F2 LATIN CAPITAL LETTER D WITH SMALL LETTER Z[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.14 public static boolean
isDigit(char ch)
The result is true if and only if the character argument is a digit.
A character is considered to be a digit if and only if both of the following are true:
ch is not in the range \u2000 through \u2FFF.
DIGIT.
Of the first 128 Unicode characters, exactly 10 are considered to be digits:0030-0039ISO-Latin-1 (and ASCII) digits ('0'-'9')0660-0669Arabic-Indic digits06F0-06F9Eastern Arabic-Indic digits0966-096FDevanagari digits09E6-09EFBengali digits0A66-0A6FGurmukhi digits0AE6-0AEFGujarati digits0B66-0B6FOriya digits0BE7-0BEFTamil digits (there are only nine of these-no zero digit)0C66-0C6FTelugu digits0CE6-0CEFKannada digits0D66-0D6FMalayalam digits0E50-0E59Thai digits0ED0-0ED9Lao digitsFF10-FF19Fullwidth digits
0123456789[This specification for the method
isDigit is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns false for all arguments larger than \u00FF.]20.5.15 public static boolean
isLetter(char ch)
The result is true if and only if the character argument is a letter.
A character is considered to be a letter if and only if it is a letter or digit (§20.5.16) but is not a digit (§20.5.14).
[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.16 public static boolean
isLetterOrDigit(char ch)
The result is true if and only if the character argument is a letter-or-digit.
A character is considered to be a letter-or-digit if and only if it is a defined Unicode character (§20.5.10) and its code lies in one of the following ranges:
It follows, then, that for Unicode 1.1.5 as corrected above, the Unicode letters and digits are exactly those with codes in the following list, which contains both single codes and inclusive ranges:0030-0039ISO-Latin-1 (and ASCII) digits ('0'-'9')0041-005AISO-Latin-1 (and ASCII) uppercase Latin letters ('A'-'Z')0061-007AISO-Latin-1 (and ASCII) lowercase Latin letters ('a'-'z')00C0-00D6ISO-Latin-1 supplementary letters00D8-00F6ISO-Latin-1 supplementary letters00F8-00FFISO-Latin-1 supplementary letters0100-1FFFLatin extended-A, Latin extended-B, IPA extensions, spacing modifier letters, combining diacritical marks, basic Greek, Greek symbols and Coptic, Cyrillic, Armenian, Hebrew extended-A, Basic Hebrew, Hebrew extended-B, Basic Arabic, Arabic extended, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Basic Georgian, Georgian extended, Hanguljamo, Latin extended additional, Greek extended3040-9FFFHiragana, Katakana, Bopomofo, Hangul compatibility Jamo, CJK miscellaneous, enclosed CJK characters and months, CJK compatibility, Hangul, Hangul supplementary-A, Hangul supplementary-B, CJK unified ideographsF900-FDFFCJK compatibility ideographs, alphabetic presentation forms, Arabic presentation forms-AFE70-FEFEArabic presentation forms-BFF10-FF19Fullwidth digitsFF21-FF3AFullwidth Latin uppercaseFF41-FF5AFullwidth Latin lowercaseFF66-FFDCHalfwidth Katakana and Hangul
0030-0039, 0041-005A, 0061-007A, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217, 0250-02A8, 02B0-02DE, 02E0-02E9, 0300-0345, 0360-0361, 0374-0375, 037A, 037E, 0384-038A, 038C, 038E, 038F-03A1, 03A3-03CE, 03D0-03D6, 03DA-03E2, 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 0401-040C, 040E-044F, 0451-045C, 045E-0486, 0490-04C4, 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9, 0531-0556, 0559-055F, 0561-0587, 0589, 05B0-05B9, 05BB-05C3, 05D0-05EA, 05F0-05F4, 060C, 061B, 061F, 0621, 0622-063A, 0640-0652, 0660-066D, 0670-06B7, 06BA-06BE, 06C0-06CE, 06D0-06ED, 06F0-06F9, 0901-0903, 0905-0939, 093C-094D, 0950-0954, 0958-0970, 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0, 09B2, 09B6-09B9, 09BC, 09BE, 09BF-09C4, 09C7-09C8, 09CB-09CD, 09D7, 09DC-09DD, 09DF-09E3, 09E6-09FA, 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30, 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3C, 0A3E, 0A3F-0A42, 0A47-0A48, 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A66-0A74, 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F, 0A90-0A91, 0A93-0AA8, 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABC-0AC5, 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0, 0AE6-0AEF, 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30, 0B32-0B33, 0B36-0B39, 0B3C-0B43, 0B47-0B48, 0B4B-0B4D, 0B56-0B57, 0B5C-0B5D, 0B5F-0B61, 0B66-0B70, 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A, 0B9C, 0B9E, 0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5, 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD, 0BD7, 0BE7-0BF2, 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33, 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C55-0C56, 0C60-0C61, 0C66-0C6F, 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3, 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CD5-0CD6, 0CDE, 0CE0, 0CE1, 0CE6-0CEF, 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39, 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D57, 0D60-0D61, 0D66-0D6F, 0E01-0E3A, 0E3F-0E5B, 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97, 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB, 0EAD-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6, 0EC8, 0EC9-0ECD, 0ED0-0ED9, 0EDC-0EDD, 10A0-10C5, 10D0-10F6, 10FB, 1100-1159, 115F-11A2, 11A8-11F9, 1E00-1E9A, 1EA0-1EF9, 1F00-1F15, 1F18-1F1D, 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D, 1F5F-1F7D, 1F80-1FB4, 1FB6-1FC4, 1FC6-1FD3, 1FD6-1FDB, 1FDD-1FEF, 1FF2-1FF4, 1FF6-1FFE, 3041-3094, 3099-309E, 30A1-30FE, 3105-312C, 3131-318E, 3190-319F, 3200-321C, 3220-3243, 3260-327B, 327F-32B0, 32C0-32CB, 32D0-32FE, 3300-3376, 337B-33DD, 33E0-33FE, 3400-9FA5, F900-FA2D, FB00-FB06, FB13-FB17, FB1E-FB36, FB38-FB3C, FB3E, FB40, FB41, FB43, FB44, FB46, FB47-FBB1, FBD3-FD3F, FD50-FD8F, FD92-FDC7, FDF0-FDFB, FE70-FE72, FE74, FE76, FE77-FEFC, FF10-FF19, FF21-FF3A, FF41-FF5A, FF66-FFBE, FFC2-FFC7, FFCA-FFCF, FFD2-FFD7, FFDA-FFDC.[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.17 public static boolean
isJavaLetter(char ch)
The result is true if and only if the character argument is a character that can begin a Java identifier.
A character is considered to be a Java letter if and only if it is a letter (§20.5.15) or is the dollar sign character '$' (\u0024) or the underscore ("low line") character '_' (\u005F).
[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.18 public static boolean
isJavaLetterOrDigit(char ch)
The result is true if and only if the character argument is a character that can occur in a Java identifier after the first character.
A character is considered to be a Java letter-or-digit if and only if it is a letter-or-digit (§20.5.16) or is the dollar sign character '$' (\u0024) or the underscore ("low line") character '_' (\u005F).
[This method is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5.]
20.5.19 public static boolean
isSpace(char ch)
The result is true if the argument ch is one of the following characters:
Otherwise, the result is'\t'\u0009 HT HORIZONTAL TABULATION'\n'\u000A LF LINE FEED (also known asNEW LINE)'\f'\u000C FF FORM FEED'\r'\u000D CR CARRIAGE RETURN''\u0020 SP SPACE
false.
20.5.20 public static char
toLowerCase(char ch)
If the character ch has a lowercase equivalent specified in the Unicode attribute
table, then that lowercase equivalent character is returned. Otherwise, the argument ch is returned.
The lowercase equivalents specified in the Unicode attribute table, for Unicode 1.1.5 as corrected above, are as follows, where character codes to the right of arrows are the lowercase equivalents of character codes to the left of arrows: 0041-005A
0061-007A, 00C0-00D6
00E0-00F6, 00D8-00DE
00F8-00FE, 0100-012E
0101-012F (evens to odds), 0132-0136
0133-0137 (evens to odds), 0139-0147
013A-0148 (odds to evens), 014A-0176
014B-0177 (evens to odds), 0178
00FF, 0179-017D
017A-017E (odds to evens), 0181
0253, 0182
0183, 0184
0185, 0186
0254, 0187
0188, 018A
0257, 018B
018C, 018E
0258, 018F
0259, 0190
025B, 0191
0192, 0193
0260, 0194
0263, 0196
0269, 0197
0268, 0198
0199, 019C
026F, 019D
0272, 01A0-01A4
01A1-01A5 (evens to odds), 01A7
01A8, 01A9
0283, 01AC
01AD, 01AE
0288, 01AF
01B0, 01B1
028A, 01B2
028B, 01B3
01B4, 01B5
01B6, 01B7
0292, 01B8
01B9, 01BC
01BD, 01C4
01C6, 01C5
01C6, 01C7
01C9, 01C8
01C9, 01CA
01CC, 01CB-01DB
01CC-01DC (odds to evens), 01DE-01EE
01DF-01EF (evens to odds), 01F1
01F3, 01F2
01F3, 01F4
01F5, 01FA-0216
01FB-0217 (evens to odds), 0386
03AC, 0388-038A
03AD-03AF, 038C
03CC, 038E
03CD, 038F
03CE, 0391-03A1
03B1-03C1, 03A3-03AB
03C3-03CB, 03E2-03EE
03E3-03EF (evens to odds), 0401-040C
0451-045C, 040E
045E, 040F
045F, 0410-042F
0430-044F, 0460-0480
0461-0481 (evens to odds), 0490-04BE
0491-04BF (evens to odds), 04C1
04C2, 04C3
04C4, 04C7
04C8, 04CB
04CC, 04D0-04EA
04D1-04EB (evens to odds), 04EE-04F4
04EF-04F5 (evens to odds), 04F8
04F9, 0531-0556
0561-0586, 10A0-10C5
10D0-10F5, 1E00-1E94
1E01-1E95 (evens to odds), 1EA0-1EF8
1EA1-1EF9 (evens to odds), 1F08-1F0F
1F00-1F07, 1F18-1F1D
1F10-1F15, 1F28-1F2F
1F20-1F27, 1F38-1F3F
1F30-1F37, 1F48-1F4D
1F40-1F45, 1F59
1F51, 1F5B
1F53, 1F5D
1F55, 1F5F
1F57, 1F68-1F6F
1F60-1F67, 1F88-1F8F
1F80-1F87, 1F98-1F9F
1F90-1F97, 1FA8-1FAF
1FA0-1FA7, 1FB8
1FB0, 1FB9
1FB1, 1FBA
1F70, 1FBB
1F71, 1FBC
1FB3, 1FC8-1FCB
1F72-1F75, 1FCC
1FC3, 1FD8
1FD0, 1FD9
1FD1, 1FDA
1F76, 1FDB
1F77, 1FE8
1FE0, 1FE9
1FE1, 1FEA
1F7A, 1FEB
1F7B, 1FEC
1FE5, 1FF8
1F78, 1FF9
1F79, 1FFA
1F7C, 1FFB
1F7D, 1FFC
1FF3, 2160-216F
2170-217F, 24B6-24CF
24D0-24E9, FF21-FF3A
FF41-FF5A.
Note that the method isLowerCase (§20.5.11) will not necessarily return true when given the result of the toLowerCase method.
[This specification for the method toLowerCase is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns its argument for all arguments larger than \u00FF.]
20.5.21 public static char
toUpperCase(char ch)
If the character ch has an uppercase equivalent specified in the Unicode attribute
table, then that uppercase equivalent character is returned. Otherwise, the argument ch is returned.
The uppercase equivalents specified in the Unicode attribute table for Unicode 1.1.5 as corrected above, are as follows, where character codes to the right of arrows are the uppercase equivalents of character codes to the left of arrows: 0061-007A
0041-005A, 00E0-00F6
00C0-00D6, 00F8-00FE
00D8-00DE, 00FF
0178, 0101-012F
0100-012E (odds to evens), 0133-0137
0132-0136 (odds to evens), 013A-0148
0139-0147 (evens to odds), 014B-0177
014A-0176 (odds to evens), 017A-017E
0179-017D (evens to odds), 017F
0053, 0183-0185
0182-0184 (odds to evens), 0188
0187, 018C
018B, 0192
0191, 0199
0198, 01A1-01A5
01A0-01A4 (odds to evens), 01A8
01A7, 01AD
01AC, 01B0
01AF, 01B4
01B3, 01B6
01B5, 01B9
01B8, 01BD
01BC, 01C5
01C4, 01C6
01C4, 01C8
01C7, 01C9
01C7, 01CB
01CA, 01CC
01CA, 01CE-01DC
01CD-01DB (evens to odds), 01DF-01EF
01DE-01EE (odds to evens), 01F2
01F1, 01F3
01F1, 01F5
01F4, 01FB-0217
01FA-0216 (odds to evens), 0253
0181, 0254
0186, 0257
018A, 0258
018E, 0259
018F, 025B
0190, 0260
0193, 0263
0194, 0268
0197, 0269
0196, 026F
019C, 0272
019D, 0283
01A9, 0288
01AE, 028A
01B1, 028B
01B2, 0292
01B7, 03AC
0386, 03AD-03AF
0388-038A, 03B1-03C1
0391-03A1, 03C2
03A3, 03C3-03CB
03A3-03AB, 03CC
038C, 03CD
038E, 03CE
038F, 03D0
0392, 03D1
0398, 03D5
03A6, 03D6
03A0, 03E3-03EF
03E2-03EE (odds to evens), 03F0
039A, 03F1
03A1, 0430-044F
0410-042F, 0451-045C
0401-040C, 045E
040E, 045F
040F, 0461-0481
0460-0480 (odds to evens), 0491-04BF
0490-04BE (odds to evens), 04C2
04C1, 04C4
04C3, 04C8
04C7, 04CC
04CB, 04D1-04EB
04D0-04EA (odds to evens), 04EF-04F5
04EE-04F4 (odds to evens), 04F9
04F8, 0561-0586
0531-0556, 1E01-1E95
1E00-1E94 (odds to evens), 1EA1-1EF9
1EA0-1EF8 (odds to evens), 1F00-1F07
1F08-1F0F, 1F10-1F15
1F18-1F1D, 1F20-1F27
1F28-1F2F, 1F30-1F37
1F38-1F3F, 1F40-1F45
1F48-1F4D, 1F51
1F59, 1F53
1F5B, 1F55
1F5D, 1F57
1F5F, 1F60-1F67
1F68-1F6F, 1F70
1FBA, 1F71
1FBB, 1F72-1F75
1FC8-1FCB, 1F76
1FDA, 1F77
1FDB, 1F78
1FF8, 1F79
1FF9, 1F7A
1FEA, 1F7B
1FEB, 1F7C
1FFA, 1F7D
1FFB, 1F80-1F87
1F88-1F8F, 1F90-1F97
1F98-1F9F, 1FA0-1FA7
1FA8-1FAF, 1FB0
1FB8, 1FB1
1FB9, 1FB3
1FBC, 1FC3
1FCC, 1FD0
1FD8, 1FD1
1FD9, 1FE0
1FE8, 1FE1
1FE9, 1FE5
1FEC, 1FF3
1FFC, 2170-217F
2160-216F, 24D0-24E9
24B6-24CF, FF41-FF5A
FF21-FF3A.
Note that the method isUpperCase (§20.5.12) will not necessarily return true when given the result of the toUpperCase method.
[This specification for the method toUpperCase is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns its argument for all arguments larger than \u00FE. Note that although \u00FF is a lowercase character, its uppercase equivalent is \u0178; toUpperCase in versions of Java prior to version 1.1 simply do not consistently handle or use Unicode character codes above \u00FF.]
20.5.22 public static char
toTitleCase(char ch)
If the character ch has a titlecase equivalent specified in the Unicode attribute
table, then that titlecase equivalent character is returned; otherwise, the argument
ch is returned.
Note that the method isTitleCase (§20.5.13) will not necessarily return true when given the result of the toTitleCase method. The Unicode attribute table always has the titlecase attribute equal to the uppercase attribute for characters that have uppercase equivalents but no separate titlecase form.
Example: Character.toTitleCase('a') returns 'A'
Example: Character.toTitleCase('Q') returns 'Q'
Example: Character.toTitleCase('lj') returns 'Lj' where 'lj' is the Unicode character \u01C9 and 'Lj' is its titlecase equivalent character \u01C8.
[This method is scheduled for introduction in Java version 1.1.]
20.5.23 public static int
digit(char ch, int radix)
Returns the numeric value of the character ch considered as a digit in the specified
radix. If the value of radix is not a valid radix, or the character ch is not a valid
digit in the specified radix, then -1 is returned.
A radix is valid if and only if its value is not less than Character.MIN_RADIX (§20.5.3) and not greater than Character.MAX_RADIX (§20.5.4).
A character is a valid digit if and only if one of the following is true:
isDigit returns true for the character, and the decimal digit value of the character, as specified in the Unicode attribute table, is less than the specified radix. In this case, the decimal digit value is returned.
'A'-'Z' (\u0041-\u005A) and its code is less than radix+'A'-10. In this case ch-'A'+10 is returned.
'a'-'z' (\u0061-\u007A) and its code is less than radix+'a'-10. In this case ch-'a'+10 is returned.
digit is scheduled for introduction in Java version 1.1, either as defined here, or updated for Unicode 2.0; see §20.5. In previous versions of Java, this method returns -1 for all character codes larger than \u00FF.]20.5.24 public static char
forDigit(int digit, int radix)
Returns a character that represents the given digit in the specified radix. If the
value of radix is not a valid radix, or the value of digit is not a valid digit in the
specified radix, the null character '\u0000' is returned.
A radix is valid if and only if its value is not less than Character.MIN_RADIX (§20.5.3) and not greater than Character.MAX_RADIX (§20.5.4).
A digit is valid if and only if it is nonnegative and less than the radix.
If the digit is less than 10, then the character value '0'+digit is returned; otherwise, 'a'+digit-10 is returned. Thus, the digits produced by forDigit, in increasing order of value, are the ASCII characters:
0123456789abcdefghijklmnopqrstuvwxyz(these are
'\u0030' through '\u0039' and '\u0061' through '\u007a'). If
uppercase letters are desired, the toUpperCase method may be called on the
result:
Character.toUpperCase(Character.forDigit(digit, radix))
java.lang.NumberNumber has subclasses Integer, Long, Float, and Double
which wrap primitive types, defining abstract methods to convert the represented
numeric value to int, long, float, and double.
public abstract classNumber{ public abstract intintValue(); public abstract longlongValue(); public abstract floatfloatValue(); public abstract doubledoubleValue(); }
20.6.1 public abstract int
intValue()
The general contract of the intValue method is that it returns the numeric value
represented by this Number object after converting it to type int.
Overridden by Integer (§20.7.8), Long (§20.8.8), Float (§20.9.12), and Double (§20.10.11).
20.6.2 public abstract long
longValue()
The general contract of the longValue method is that it returns the numeric value
represented by this Number object after converting it to type long.
Overridden by Integer (§20.7.9), Long (§20.8.9), Float (§20.9.13), and Double (§20.10.12).
20.6.3 public abstract float
floatValue()
The general contract of the floatValue method is that it returns the numeric
value represented by this Number object after converting it to type float.
Overridden by Integer (§20.7.10), Long (§20.8.10), Float (§20.9.14), and Double (§20.10.13).
20.6.4 public abstract double
doubleValue()
The general contract of the doubleValue method is that it returns the numeric
value represented by this Number object after converting it to type double.
Overridden by Integer (§20.7.11), Long (§20.8.11), Float (§20.9.15), and Double (§20.10.14).
java.lang.Integerpublic final classIntegerextends Number { public static final intMIN_VALUE= 0x80000000; public static final intMAX_VALUE= 0x7fffffff; publicInteger(int value); publicInteger(String s)
throws NumberFormatException; public StringtoString(); public booleanequals(Object obj); public inthashCode(); public intintValue(); public longlongValue(); public floatfloatValue(); public doubledoubleValue(); public static StringtoString(int i); public static StringtoString(int i, int radix); public static StringtoHexString(long i); public static StringtoOctalString(long i); public static StringtoBinaryString(long i); public static intparseInt(String s)
throws NumberFormatException; public static intparseInt(String s, int radix)
throws NumberFormatException; public static IntegervalueOf(String s)
throws NumberFormatException; public static IntegervalueOf(String s, int radix)
throws NumberFormatException; public static IntegergetInteger(String nm); public static IntegergetInteger(String nm, int val); public static IntegergetInteger(String nm, Integer val); }
20.7.1 public static final int
MIN_VALUE = 0x80000000;
The constant value of this field is -2147483648, the lowest value of type int.
20.7.2 public static final int
MAX_VALUE = 0x7fffffff;
The constant value of this field is 2147483647, the highest value of type int.
20.7.3 public
Integer(int value)
This constructor initializes a newly created Integer object so that it represents
the primitive value that is the argument.
20.7.4 public
Integer(String s) throws NumberFormatException
This constructor initializes a newly created Integer object so that it represents
the integer represented by the string in decimal form. The string is converted to an
int in exactly the manner used by the parseInt method (§20.7.18) for radix 10.
20.7.5 public String
toString()
The integer value represented by this Integer object is converted to signed decimal representation and returned as a string, exactly as if the integer value were
given as an argument to the toString method that takes one argument (§20.7.12).
Overrides the toString method of Object (§20.1.2).
20.7.6 public boolean
equals(Object obj)
The result is true if and only if the argument is not null and is an Integer
object that represents the same int value as this Integer object.
Overrides the equals method of Object (§20.1.3).
20.7.7 public int
hashCode()
The result is the primitive int value represented by this Integer object.
Overrides the hashCode method of Object (§20.1.4).
20.7.8 public int
intValue()
The int value represented by this Integer object is returned.
Overrides the intValue method of Number (§20.6.1).
20.7.9 public long
longValue()
The int value represented by this Integer object is converted (§5.1.2) to type
long and the result of the conversion is returned.
Overrides the longValue method of Number (§20.6.2).
20.7.10 public float
floatValue()
The int value represented by this Integer object is converted (§5.1.2) to type
float and the result of the conversion is returned.
Overrides the floatValue method of Number (§20.6.3).
20.7.11 public double
doubleValue()
The int value represented by this Integer object is converted (§5.1.2) to type
double and the result of the conversion is returned.
Overrides the doubleValue method of Number (§20.6.4).
20.7.12 public static String
toString(int i)
The argument is converted to signed decimal representation and returned as a
string, exactly as if the argument and the radix 10 were given as arguments to the
toString method that takes two arguments (§20.7.13).
20.7.13 public static String
toString(int i, int radix)
The first argument is converted to a signed representation in the radix specified by the second argument; this representation is returned as a string.
If the radix is smaller than Character.MIN_RADIX (§20.5.3) or larger than Character.MAX_RADIX (§20.5.4), then the value 10 is used instead.
If the first argument is negative, the first character of the result will be the character '-' ('\u002d'). If the first argument is not negative, no sign character appears in the result.
The remaining characters of the result represent the magnitude of the first argument. If the magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the magnitude will not be the zero character.The following ASCII characters are used as digits:
0123456789abcdefghijklmnopqrstuvwxyz
These are '\u0030' through '\u0039' and '\u0061' through '\u007a'. If the
radix is N, then the first N of these characters are used as radix-N digits in the
order shown. Thus, the digits for hexadecimal (radix 16) are 0123456789abcdef.
If uppercase letters are desired, the toUpperCase method (§20.12.36) of class
String may be called on the result:
Integer.toString(n, 16).toUpperCase()
20.7.14 public static String
toHexString(int i)
The argument is converted to an unsigned representation in hexadecimal radix (base 16); this representation is returned as a string.
The result represents the unsigned magnitude of the argument. This equals the argument plus
if the argument is negative; otherwise, it equals the argument.
If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:
0123456789abcdef
These are the characters '\u0030' through '\u0039' and '\u0061' through
'\u0066'. If uppercase letters are desired, the toUpperCase method (§20.12.36)
of class String may be called on the result:
Long.toHexString(n).toUpperCase()
20.7.15 public static String
toOctalString(int i)
The argument is converted to an unsigned representation in octal radix (base 8); this representation is returned as a string.
The result represents the unsigned magnitude of the argument. This equals the argument plus
if the argument is negative; otherwise, it equals the argument.
If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The octal digits are:
01234567
These are the characters '\u0030' through '\u0037'.
20.7.16 public static String
toBinaryString(int i)
The argument is converted to an unsigned representation in binary radix (base 2); this representation is returned as a string.
The result represents the unsigned magnitude of the argument. This equals the argument plus
if the argument is negative; otherwise, it equals the argument.
If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits.
20.7.17 p