1 *java.lang.Byte* *Byte* The Byte class wraps a value of primitive type
4 public final class Byte
5 extends |java.lang.Number|
6 implements |java.lang.Comparable|
8 |java.lang.Byte_Description|
9 |java.lang.Byte_Fields|
10 |java.lang.Byte_Constructors|
11 |java.lang.Byte_Methods|
13 ================================================================================
15 *java.lang.Byte_Fields*
16 |byte_java.lang.Byte.MAX_VALUE|
17 |byte_java.lang.Byte.MIN_VALUE|
18 |int_java.lang.Byte.SIZE|
19 |java.lang.Class<java.lang.Byte>_java.lang.Byte.TYPE|
21 *java.lang.Byte_Constructors*
22 |java.lang.Byte(byte)|Constructs a newly allocated Byte object that represents
23 |java.lang.Byte(String)|Constructs a newly allocated Byte object that represen
25 *java.lang.Byte_Methods*
26 |java.lang.Byte.byteValue()|Returns the value of this Byte as a byte.
27 |java.lang.Byte.compareTo(Byte)|Compares two Byte objects numerically.
28 |java.lang.Byte.decode(String)|Decodes a String into a Byte.
29 |java.lang.Byte.doubleValue()|Returns the value of this Byte as a double.
30 |java.lang.Byte.equals(Object)|Compares this object to the specified object.
31 |java.lang.Byte.floatValue()|Returns the value of this Byte as a float.
32 |java.lang.Byte.hashCode()|Returns a hash code for this Byte.
33 |java.lang.Byte.intValue()|Returns the value of this Byte as an int.
34 |java.lang.Byte.longValue()|Returns the value of this Byte as a long.
35 |java.lang.Byte.parseByte(String)|Parses the string argument as a signed decima
36 |java.lang.Byte.parseByte(String,int)|Parses the string argument as a signed by
37 |java.lang.Byte.shortValue()|Returns the value of this Byte as a short.
38 |java.lang.Byte.toString()|Returns a String object representing this Byte's va
39 |java.lang.Byte.toString(byte)|Returns a new String object representing the sp
40 |java.lang.Byte.valueOf(byte)|Returns a Byte instance representing the specifie
41 |java.lang.Byte.valueOf(String)|Returns a Byte object holding the value given
42 |java.lang.Byte.valueOf(String,int)|Returns a Byte object holding the value ex
44 *java.lang.Byte_Description*
46 The Byte class wraps a value of primitive type byte in an object. An object of
47 type Byte contains a single field whose type is byte.
51 In addition, this class provides several methods for converting a byte to a
52 String and a String to a byte, as well as other constants and methods useful
53 when dealing with a byte.
57 *byte_java.lang.Byte.MAX_VALUE*
59 A constant holding the maximum value a byte can have, 27-1.
62 *byte_java.lang.Byte.MIN_VALUE*
64 A constant holding the minimum value a byte can have, -27.
67 *int_java.lang.Byte.SIZE*
69 The number of bits used to represent a byte value in two's complement binary
73 *java.lang.Class<java.lang.Byte>_java.lang.Byte.TYPE*
75 The Class instance representing the primitive type byte.
79 *java.lang.Byte(byte)*
81 public Byte(byte value)
83 Constructs a newly allocated Byte object that represents the specified byte
86 value - the value to be represented by the Byte.
88 *java.lang.Byte(String)*
90 public Byte(java.lang.String s)
91 throws |java.lang.NumberFormatException|
93 Constructs a newly allocated Byte object that represents the byte value
94 indicated by the String parameter. The string is converted to a byte value in
95 exactly the manner used by the parseByte method for radix 10.
97 s - the String to be converted to a Byte
99 *java.lang.Byte.byteValue()*
101 public byte byteValue()
103 Returns the value of this Byte as a byte.
107 *java.lang.Byte.compareTo(Byte)*
109 public int compareTo(java.lang.Byte anotherByte)
111 Compares two Byte objects numerically.
114 anotherByte - the Byte to be compared.
116 Returns: the value 0 if this Byte is equal to the argument Byte; a value less than 0 if
117 this Byte is numerically less than the argument Byte; and a value
118 greater than 0 if this Byte is numerically greater than the
119 argument Byte (signed comparison).
121 *java.lang.Byte.decode(String)*
123 public static |java.lang.Byte| decode(java.lang.String nm)
124 throws |java.lang.NumberFormatException|
126 Decodes a String into a Byte. Accepts decimal, hexadecimal, and octal numbers
127 given by the following grammar:
131 DecodableString: Signopt DecimalNumeral Signopt 0x HexDigits Signopt 0X
132 HexDigits Signopt # HexDigits Signopt 0 OctalDigits
138 DecimalNumeral, HexDigits, and OctalDigits are defined in 3.10.1 of the Java
139 Language Specification.
141 The sequence of characters following an (optional) negative sign and/or radix
142 specifier (0x, 0X, #, or leading zero) is parsed as by the Byte.parseByte
143 method with the indicated radix (10, 16, or 8). This sequence of characters
144 must represent a positive value or a (|java.lang.NumberFormatException|) will
145 be thrown. The result is negated if first character of the specified String is
146 the minus sign. No whitespace characters are permitted in the String.
149 nm - the String to decode.
151 Returns: a Byte object holding the byte value represented by nm
153 *java.lang.Byte.doubleValue()*
155 public double doubleValue()
157 Returns the value of this Byte as a double.
161 *java.lang.Byte.equals(Object)*
163 public boolean equals(java.lang.Object obj)
165 Compares this object to the specified object. The result is true if and only if
166 the argument is not null and is a Byte object that contains the same byte value
170 obj - the object to compare with
172 Returns: true if the objects are the same; false otherwise.
174 *java.lang.Byte.floatValue()*
176 public float floatValue()
178 Returns the value of this Byte as a float.
182 *java.lang.Byte.hashCode()*
184 public int hashCode()
186 Returns a hash code for this Byte.
190 *java.lang.Byte.intValue()*
192 public int intValue()
194 Returns the value of this Byte as an int.
198 *java.lang.Byte.longValue()*
200 public long longValue()
202 Returns the value of this Byte as a long.
206 *java.lang.Byte.parseByte(String)*
208 public static byte parseByte(java.lang.String s)
209 throws |java.lang.NumberFormatException|
211 Parses the string argument as a signed decimal byte. The characters in the
212 string must all be decimal digits, except that the first character may be an
213 ASCII minus sign '-' ('u002D') to indicate a negative value. The resulting byte
214 value is returned, exactly as if the argument and the radix 10 were given as
215 arguments to the (|java.lang.Byte|) method.
218 s - a String containing the byte representation to be parsed
220 Returns: the byte value represented by the argument in decimal
222 *java.lang.Byte.parseByte(String,int)*
224 public static byte parseByte(
227 throws |java.lang.NumberFormatException|
229 Parses the string argument as a signed byte in the radix specified by the
230 second argument. The characters in the string must all be digits, of the
231 specified radix (as determined by whether (|java.lang.Character|) returns a
232 nonnegative value) except that the first character may be an ASCII minus sign
233 '-' ('u002D') to indicate a negative value. The resulting byte value is
236 An exception of type NumberFormatException is thrown if any of the following
239 The first argument is null or is a string of length zero.
241 The radix is either smaller than (|java.lang.Character|) or larger than
242 (|java.lang.Character|) .
244 Any character of the string is not a digit of the specified radix, except that
245 the first character may be a minus sign '-' ('u002D') provided that the string
246 is longer than length 1.
248 The value represented by the string is not a value of type byte.
251 s - the String containing the byte representation to be parsed
252 radix - the radix to be used while parsing s
254 Returns: the byte value represented by the string argument in the specified radix
256 *java.lang.Byte.shortValue()*
258 public short shortValue()
260 Returns the value of this Byte as a short.
264 *java.lang.Byte.toString()*
266 public |java.lang.String| toString()
268 Returns a String object representing this Byte's value. The value is converted
269 to signed decimal representation and returned as a string, exactly as if the
270 byte value were given as an argument to the (|java.lang.Byte|) method.
274 Returns: a string representation of the value of this object in base10.
276 *java.lang.Byte.toString(byte)*
278 public static |java.lang.String| toString(byte b)
280 Returns a new String object representing the specified byte. The radix is
284 b - the byte to be converted
286 Returns: the string representation of the specified byte
288 *java.lang.Byte.valueOf(byte)*
290 public static |java.lang.Byte| valueOf(byte b)
292 Returns a Byte instance representing the specified byte value. If a new Byte
293 instance is not required, this method should generally be used in preference to
294 the constructor (|java.lang.Byte|) , as this method is likely to yield
295 significantly better space and time performance by caching frequently requested
301 Returns: a Byte instance representing b.
303 *java.lang.Byte.valueOf(String)*
305 public static |java.lang.Byte| valueOf(java.lang.String s)
306 throws |java.lang.NumberFormatException|
308 Returns a Byte object holding the value given by the specified String. The
309 argument is interpreted as representing a signed decimal byte, exactly as if
310 the argument were given to the (|java.lang.Byte|) method. The result is a Byte
311 object that represents the byte value specified by the string. In other words,
312 this method returns a Byte object equal to the value of:
314 new Byte(Byte.parseByte(s))
317 s - the string to be parsed
319 Returns: a Byte object holding the value represented by the string argument
321 *java.lang.Byte.valueOf(String,int)*
323 public static |java.lang.Byte| valueOf(
326 throws |java.lang.NumberFormatException|
328 Returns a Byte object holding the value extracted from the specified String
329 when parsed with the radix given by the second argument. The first argument is
330 interpreted as representing a signed byte in the radix specified by the second
331 argument, exactly as if the argument were given to the (|java.lang.Byte|)
332 method. The result is a Byte object that represents the byte value specified by
333 the string. In other words, this method returns a Byte object equal to the
336 new Byte(Byte.parseByte(s, radix))
339 s - the string to be parsed
340 radix - the radix to be used in interpreting s
342 Returns: a Byte object holding the value represented by the string argument in the