public class UnsignedShort extends java.lang.Number implements java.lang.Comparable<UnsignedShort>
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
The number of bytes used to represent a
unsigned short value in
two's complement binary form. |
static int |
MAX_VALUE
A constant holding the maximum value a
unsigned short can have,
216-1. |
static int |
MIN_VALUE
A constant holding the minimum value a
unsigned short can have, 0. |
static int |
SIZE
The number of bits used to represent a
unsigned short value in
two's complement binary form. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(UnsignedShort o) |
double |
doubleValue() |
float |
floatValue() |
int |
intValue() |
long |
longValue() |
static short |
parseUnsignedShort(java.lang.String s,
int radix)
Parses the string argument as an unsigned integer in the radix specified by
the second argument.
|
java.lang.String |
toString() |
static UnsignedShort |
valueOf(short s)
Returns an
UnsignedShort instance representing the specified
short value. |
static UnsignedShort |
valueOf(java.lang.String s)
Returns an
UnsignedShort object holding the value of the specified
String . |
static UnsignedShort |
valueOf(java.lang.String s,
int radix)
Returns an
UnsignedShort object holding the value extracted from
the specified String when parsed with the radix given by the second
argument. |
public static final int BYTES
unsigned short
value in
two's complement binary form.public static final int MAX_VALUE
unsigned short
can have,
216-1.public static final int MIN_VALUE
unsigned short
can have, 0.public static final int SIZE
unsigned short
value in
two's complement binary form.public static short parseUnsignedShort(java.lang.String s, int radix)
s
- the String
containing the unsigned short
representation to be parsedradix
- the radix to be used while parsing s
.java.lang.NumberFormatException
- if the String
does not contain a
parsable unsigned short
.public static UnsignedShort valueOf(short s)
UnsignedShort
instance representing the specified
short
value.s
- a short value.public static UnsignedShort valueOf(java.lang.String s) throws java.lang.NumberFormatException
UnsignedShort
object holding the value of the specified
String
. The argument is interpreted as representing an unsigned
decimal integer, exactly as if the argument were given to the
#parseInt(java.lang.String)
method. The result is an
UnsignedShort
object that represents the integer value specified by
the string.
In other words, this method returns an UnsignedShort
object equal
to the value of:
new UnsignedShort(UnsignedShort.parseUnsignedShort(s))
s
- the string to be parsed.UnsignedShort
object holding the value represented by
the string argument.java.lang.NumberFormatException
- if the string cannot be parsed as an
integer.public static UnsignedShort valueOf(java.lang.String s, int radix) throws java.lang.NumberFormatException
UnsignedShort
object holding the value extracted from
the specified String
when parsed with the radix given by the second
argument. The first argument is interpreted as representing an unsigned
integer in the radix specified by the second argument, exactly as if the
arguments were given to the #parseInt(java.lang.String, int)
method. The result is an UnsignedShort
object that represents the
integer value specified by the string.
In other words, this method returns an UnsignedShort
object equal
to the value of:
new UnsignedShort(UnsignedShort.parseUnsignedShort(s, radix))
s
- the string to be parsed.radix
- the radix to be used in interpreting s
UnsignedShort
object holding the value represented by
the string argument in the specified radix.java.lang.NumberFormatException
- if the String
does not contain a
parsable int
.public int compareTo(UnsignedShort o)
compareTo
in interface java.lang.Comparable<UnsignedShort>
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public java.lang.String toString()
toString
in class java.lang.Object