|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--java.lang.Byte
The Byte class is the standard wrapper for byte values.
Number
, Serialized FormField Summary | |
static byte |
MAX_VALUE
The maximum value a Byte can have. |
static byte |
MIN_VALUE
The minimum value a Byte can have. |
static Class |
TYPE
The Class object representing the primitive type byte. |
Constructor Summary | |
Byte(byte value)
Constructs a Byte object initialized to the specified byte value. |
|
Byte(String s)
Constructs a Byte object initialized to the value specified by the String parameter. |
Method Summary | |
byte |
byteValue()
Returns the value of this Byte as a byte. |
int |
compareTo(Byte anotherByte)
Compares two Bytes numerically. |
int |
compareTo(Object o)
Compares this Byte to another Object. |
static Byte |
decode(String nm)
Decodes a String into a Byte . |
double |
doubleValue()
Returns the value of this Byte as a double. |
boolean |
equals(Object obj)
Compares this object to the specified object. |
float |
floatValue()
Returns the value of this Byte as a float. |
int |
hashCode()
Returns a hashcode for this Byte. |
int |
intValue()
Returns the value of this Byte as an int. |
long |
longValue()
Returns the value of this Byte as a long. |
static byte |
parseByte(String s)
Assuming the specified String represents a byte, returns that byte's value. |
static byte |
parseByte(String s,
int radix)
Assuming the specified String represents a byte, returns that byte's value. |
short |
shortValue()
Returns the value of this Byte as a short. |
String |
toString()
Returns a String object representing this Byte's value. |
static String |
toString(byte b)
Returns a new String object representing the specified Byte. |
static Byte |
valueOf(String s)
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. |
static Byte |
valueOf(String s,
int radix)
Assuming the specified String represents a byte, returns a new Byte object initialized to that value. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte MIN_VALUE
public static final byte MAX_VALUE
public static final Class TYPE
Constructor Detail |
public Byte(byte value)
value
- the initial value of the Bytepublic Byte(String s) throws NumberFormatException
s
- the String to be converted to a ByteNumberFormatException
- If the String does not
contain a parsable byte.Method Detail |
public static String toString(byte b)
b
- the byte to be convertedbyte
public static byte parseByte(String s) throws NumberFormatException
s
- the String containing the byteNumberFormatException
- If the string does not
contain a parsable byte.public static byte parseByte(String s, int radix) throws NumberFormatException
s
- the String containing the byteradix
- the radix to be usedNumberFormatException
- If the String does not
contain a parsable byte.public static Byte valueOf(String s, int radix) throws NumberFormatException
s
- the String containing the integerradix
- the radix to be usedByte
instance representing the parsed
byte
valueNumberFormatException
- If the String does not
contain a parsable byte.public static Byte valueOf(String s) throws NumberFormatException
s
- the String containing the integerByte
instance representing the parsed
byte
valueNumberFormatException
- If the String does not
contain a parsable byte.public static Byte decode(String nm) throws NumberFormatException
String
into a Byte
. Accepts
decimal, hexadecimal, and octal numbers, in the following formats:
[-] decimal constant [-] 0x hex constant [-] # hex constant [-] 0 octal constantThe constant following an (optional) negative sign and/or "radix specifier" is parsed as by the
Byte.parseByte
method
with the specified radix (10, 8 or 16). This constant must be positive
or a NumberFormatException will result. The result is made negative if
first character of the specified String
is the negative
sign. No whitespace characters are permitted in the
String
.nm
- the String
to decode.Byte
represented by the specified string.NumberFormatException
- if the String
does not
contain a parsable byte.parseByte(String, int)
public byte byteValue()
byteValue
in class Number
java.lang.Number
byte
.public short shortValue()
shortValue
in class Number
java.lang.Number
short
.public int intValue()
intValue
in class Number
java.lang.Number
int
.public long longValue()
longValue
in class Number
java.lang.Number
long
.public float floatValue()
floatValue
in class Number
java.lang.Number
float
.public double doubleValue()
doubleValue
in class Number
java.lang.Number
double
.public String toString()
toString
in class Object
java.lang.Object
public int hashCode()
hashCode
in class Object
java.lang.Object
Object.equals(java.lang.Object)
,
Hashtable
public boolean equals(Object obj)
equals
in class Object
obj
- the object to compare withpublic int compareTo(Byte anotherByte)
anotherByte
- the Byte
to be compared.0
if the argument Byte is equal to
this Byte; a value less than 0
if this Byte
is numerically less than the Byte argument; and a
value greater than 0
if this Byte is
numerically greater than the Byte argument (signed comparison).public int compareTo(Object o)
compareTo(Byte)
. Otherwise,
it throws a ClassCastException
(as Bytes are comparable
only to other Bytes).compareTo
in interface Comparable
o
- the Object
to be compared.0
if the argument is a Byte
numerically equal to this Byte; a value less than
0
if the argument is a Byte numerically
greater than this Byte; and a value greater than
0
if the argument is a Byte numerically
less than this Byte.ClassCastException
- if the argument is not a
Byte
.Comparable
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.