Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
This commit is contained in:
parent
02e549bfaa
commit
8f523f3a10
1241 changed files with 97711 additions and 25284 deletions
|
@ -50,7 +50,7 @@ package java.lang;
|
|||
* @author Per Bothner
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
* @status updated to 1.5
|
||||
*/
|
||||
public final class Byte extends Number implements Comparable
|
||||
{
|
||||
|
@ -77,6 +77,16 @@ public final class Byte extends Number implements Comparable
|
|||
*/
|
||||
public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
|
||||
|
||||
/**
|
||||
* The number of bits needed to represent a <code>byte</code>.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static final int SIZE = 8;
|
||||
|
||||
// This caches Byte values, and is used by boxing conversions via
|
||||
// valueOf(). We're required to cache all possible values here.
|
||||
private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
|
||||
|
||||
/**
|
||||
* The immutable value of this Byte.
|
||||
*
|
||||
|
@ -192,6 +202,26 @@ public final class Byte extends Number implements Comparable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>Byte</code> object wrapping the value.
|
||||
* In contrast to the <code>Byte</code> constructor, this method
|
||||
* will cache some values. It is used by boxing conversion.
|
||||
*
|
||||
* @param val the value to wrap
|
||||
* @return the <code>Byte</code>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static Byte valueOf(byte val)
|
||||
{
|
||||
synchronized (byteCache)
|
||||
{
|
||||
if (byteCache[val - MIN_VALUE] == null)
|
||||
byteCache[val - MIN_VALUE] = new Byte(val);
|
||||
return byteCache[val - MIN_VALUE];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified <code>String</code> into a <code>Byte</code>.
|
||||
* The <code>String</code> may represent decimal, hexadecimal, or
|
||||
* octal numbers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue