Improved techniques for representation of Java string objects are disclosed.
The techniques can be implemented to create Java string objects as arrays of one-byte
characters when it is appropriate. To create Java string objects, an enhanced constructor
can be provided in a Java library that is available to application programs (or
programmers). In addition, enhanced Java methods can also be provided in the Java
library. An array representation flag can optionally be allocated in the Java string
object representation. The array representation flag can indicate whether the Java
string object is allocated as an array of one-byte or an array of two-byte characters.
Alternatively, the element type of the array can be referenced by using one or
more references to determine whether the Java string object has been allocated
as an array of one-byte or as an array of two-byte characters.