Half
public
final
class
Half
extends Number
implements
Comparable<Half>
java.lang.Object  
↳  java.lang.Number  
↳  android.util.Half 
The Half
class is a wrapper and a utility class to manipulate halfprecision 16bit
IEEE 754
floating point data types (also called fp16 or binary16). A halfprecision float can be
created from or converted to singleprecision floats, and is stored in a short data type.
To distinguish short values holding halfprecision floats from regular short values,
it is recommended to use the @HalfFloat
annotation.
The IEEE 754 standard specifies an fp16 as having the following format:
 Sign bit: 1 bit
 Exponent width: 5 bits
 Significand: 10 bits
The format is laid out as follows:
1 11111 1111111111 ^ ^ ^ sign  _______ significand   exponent
Halfprecision floating points can be useful to save memory and/or bandwidth at the expense of range and precision when compared to singleprecision floating points (fp32).
To help you decide whether fp16 is the right storage type for you need, please refer to the table below that shows the available precision throughout the range of possible values. The precision column indicates the step size between two consecutive numbers in a specific part of the range.
Range start  Precision 

0  1 ⁄ 16,777,216 
1 ⁄ 16,384  1 ⁄ 16,777,216 
1 ⁄ 8,192  1 ⁄ 8,388,608 
1 ⁄ 4,096  1 ⁄ 4,194,304 
1 ⁄ 2,048  1 ⁄ 2,097,152 
1 ⁄ 1,024  1 ⁄ 1,048,576 
1 ⁄ 512  1 ⁄ 524,288 
1 ⁄ 256  1 ⁄ 262,144 
1 ⁄ 128  1 ⁄ 131,072 
1 ⁄ 64  1 ⁄ 65,536 
1 ⁄ 32  1 ⁄ 32,768 
1 ⁄ 16  1 ⁄ 16,384 
1 ⁄ 8  1 ⁄ 8,192 
1 ⁄ 4  1 ⁄ 4,096 
1 ⁄ 2  1 ⁄ 2,048 
1  1 ⁄ 1,024 
2  1 ⁄ 512 
4  1 ⁄ 256 
8  1 ⁄ 128 
16  1 ⁄ 64 
32  1 ⁄ 32 
64  1 ⁄ 16 
128  1 ⁄ 8 
256  1 ⁄ 4 
512  1 ⁄ 2 
1,024  1 
2,048  2 
4,096  4 
8,192  8 
16,384  16 
32,768  32 
This table shows that numbers higher than 1024 lose all fractional precision.
Summary
Constants  

short 
EPSILON
Epsilon is the difference between 1.0 and the next value representable by a halfprecision floatingpoint. 
short 
LOWEST_VALUE
Smallest negative value a halfprecision float may have. 
int 
MAX_EXPONENT
Maximum exponent a finite halfprecision float may have. 
short 
MAX_VALUE
Maximum positive finite value a halfprecision float may have. 
int 
MIN_EXPONENT
Minimum exponent a normalized halfprecision float may have. 
short 
MIN_NORMAL
Smallest positive normal value a halfprecision float may have. 
short 
MIN_VALUE
Smallest positive nonzero value a halfprecision float may have. 
short 
NEGATIVE_INFINITY
Negative infinity of type halfprecision float. 
short 
NEGATIVE_ZERO
Negative 0 of type halfprecision float. 
short 
NaN
A NotaNumber representation of a halfprecision float. 
short 
POSITIVE_INFINITY
Positive infinity of type halfprecision float. 
short 
POSITIVE_ZERO
Positive 0 of type halfprecision float. 
int 
SIZE
The number of bits used to represent a halfprecision float value. 
Public constructors  

Half(short value)
Constructs a newly allocated 

Half(float value)
Constructs a newly allocated 

Half(double value)
Constructs a newly allocated 

Half(String value)
Constructs a newly allocated 
Public methods  

static
short

abs(short h)
Returns the absolute value of the specified halfprecision float. 
byte

byteValue()
Returns the value of this 
static
short

ceil(short h)
Returns the smallest halfprecision float value toward negative infinity greater than or equal to the specified halfprecision float value. 
static
int

compare(short x, short y)
Compares the two specified halfprecision float values. 
int

compareTo(Half h)
Compares the two specified halfprecision float values. 
static
short

copySign(short magnitude, short sign)
Returns the first parameter with the sign of the second parameter. 
double

doubleValue()
Returns the value of this 
static
boolean

equals(short x, short y)
Returns true if the two halfprecision float values are equal. 
boolean

equals(Object o)
Compares this object against the specified object. 
float

floatValue()
Returns the value of this 
static
short

floor(short h)
Returns the largest halfprecision float value toward positive infinity less than or equal to the specified halfprecision float value. 
static
int

getExponent(short h)
Returns the unbiased exponent used in the representation of the specified halfprecision float value. 
static
int

getSign(short h)
Returns the sign of the specified halfprecision float. 
static
int

getSignificand(short h)
Returns the significand, or mantissa, used in the representation of the specified halfprecision float value. 
static
boolean

greater(short x, short y)
Returns true if the first halfprecision float value is greater (larger toward positive infinity) than the second halfprecision float value. 
static
boolean

greaterEquals(short x, short y)
Returns true if the first halfprecision float value is greater (larger toward positive infinity) than or equal to the second halfprecision float value. 
static
int

halfToIntBits(short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in 
static
int

halfToRawIntBits(short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in 
static
short

halfToShortBits(short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in 
short

halfValue()
Returns the halfprecision value of this 
static
int

hashCode(short h)
Returns a hash code for a halfprecision float value. 
int

hashCode()
Returns a hash code for this 
static
short

intBitsToHalf(int bits)
Returns the halfprecision float value corresponding to a given bit representation. 
int

intValue()
Returns the value of this 
static
boolean

isInfinite(short h)
Returns true if the specified halfprecision float value represents infinity, false otherwise. 
boolean

isNaN()
Returns true if this 
static
boolean

isNaN(short h)
Returns true if the specified halfprecision float value represents a NotaNumber, false otherwise. 
static
boolean

isNormalized(short h)
Returns true if the specified halfprecision float value is normalized (does not have a subnormal representation). 
static
boolean

less(short x, short y)
Returns true if the first halfprecision float value is less (smaller toward negative infinity) than the second halfprecision float value. 
static
boolean

lessEquals(short x, short y)
Returns true if the first halfprecision float value is less (smaller toward negative infinity) than or equal to the second halfprecision float value. 
long

longValue()
Returns the value of this 
static
short

max(short x, short y)
Returns the larger of two halfprecision float values (the value closest to positive infinity). 
static
short

min(short x, short y)
Returns the smaller of two halfprecision float values (the value closest to negative infinity). 
static
short

parseHalf(String s)
Returns the halfprecision float value represented by the specified string. 
static
short

round(short h)
Returns the closest integral halfprecision float value to the specified halfprecision float value. 
short

shortValue()
Returns the value of this 
static
float

toFloat(short h)
Converts the specified halfprecision float value into a singleprecision float value. 
static
short

toHalf(float f)
Converts the specified singleprecision float value into a halfprecision float value. 
static
String

toHexString(short h)
Returns a hexadecimal string representation of the specified halfprecision float value. 
static
String

toString(short h)
Returns a string representation of the specified halfprecision float value. 
String

toString()
Returns a string representation of the specified halfprecision float value. 
static
short

trunc(short h)
Returns the truncated halfprecision float value of the specified halfprecision float value. 
static
Half

valueOf(String s)
Returns a 
static
Half

valueOf(float f)
Returns a 
static
Half

valueOf(short h)
Returns a 
Inherited methods  

Constants
EPSILON
public static final short EPSILON
Epsilon is the difference between 1.0 and the next value representable by a halfprecision floatingpoint.
Constant Value: 5120 (0x00001400)
LOWEST_VALUE
public static final short LOWEST_VALUE
Smallest negative value a halfprecision float may have.
Constant Value: 1025 (0xfffffbff)
MAX_EXPONENT
public static final int MAX_EXPONENT
Maximum exponent a finite halfprecision float may have.
Constant Value: 15 (0x0000000f)
MAX_VALUE
public static final short MAX_VALUE
Maximum positive finite value a halfprecision float may have.
Constant Value: 31743 (0x00007bff)
MIN_EXPONENT
public static final int MIN_EXPONENT
Minimum exponent a normalized halfprecision float may have.
Constant Value: 14 (0xfffffff2)
MIN_NORMAL
public static final short MIN_NORMAL
Smallest positive normal value a halfprecision float may have.
Constant Value: 1024 (0x00000400)
MIN_VALUE
public static final short MIN_VALUE
Smallest positive nonzero value a halfprecision float may have.
Constant Value: 1 (0x00000001)
NEGATIVE_INFINITY
public static final short NEGATIVE_INFINITY
Negative infinity of type halfprecision float.
Constant Value: 1024 (0xfffffc00)
NEGATIVE_ZERO
public static final short NEGATIVE_ZERO
Negative 0 of type halfprecision float.
Constant Value: 32768 (0xffff8000)
NaN
public static final short NaN
A NotaNumber representation of a halfprecision float.
Constant Value: 32256 (0x00007e00)
POSITIVE_INFINITY
public static final short POSITIVE_INFINITY
Positive infinity of type halfprecision float.
Constant Value: 31744 (0x00007c00)
POSITIVE_ZERO
public static final short POSITIVE_ZERO
Positive 0 of type halfprecision float.
Constant Value: 0 (0x00000000)
SIZE
public static final int SIZE
The number of bits used to represent a halfprecision float value.
Constant Value: 16 (0x00000010)
Public constructors
Half
public Half (short value)
Constructs a newly allocated Half
object that represents the
halfprecision float type argument.
Parameters  

value 
short : The value to be represented by the Half

Half
public Half (float value)
Constructs a newly allocated Half
object that represents the
argument converted to a halfprecision float.
Parameters  

value 
float : The value to be represented by the Half 
See also:
Half
public Half (double value)
Constructs a newly allocated Half
object that
represents the argument converted to a halfprecision float.
Parameters  

value 
double : The value to be represented by the Half 
See also:
Half
public Half (String value)
Constructs a newly allocated Half
object that represents the
halfprecision float value represented by the string.
The string is converted to a halfprecision float value as if by the
valueOf(String)
method.
Calling this constructor is equivalent to calling:
new Half(Float.parseFloat(value))
Parameters  

value 
String : A string to be converted to a Half This value must never be 
Throws  

NumberFormatException 
if the string does not contain a parsable number 
Public methods
abs
public static short abs (short h)
Returns the absolute value of the specified halfprecision float. Special values are handled in the following ways:
 If the specified halfprecision float is NaN, the result is NaN
 If the specified halfprecision float is zero (negative or positive),
the result is positive zero (see
POSITIVE_ZERO
)  If the specified halfprecision float is infinity (negative or positive),
the result is positive infinity (see
POSITIVE_INFINITY
)
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The absolute value of the specified halfprecision float 
byteValue
public byte byteValue ()
Returns the value of this Half
as a byte
after
a narrowing primitive conversion.
Returns  

byte 
The halfprecision float value represented by this object
converted to type byte

ceil
public static short ceil (short h)
Returns the smallest halfprecision float value toward negative infinity greater than or equal to the specified halfprecision float value. Special values are handled in the following ways:
 If the specified halfprecision float is NaN, the result is NaN
 If the specified halfprecision float is infinity (negative or positive), the result is infinity (with the same sign)
 If the specified halfprecision float is zero (negative or positive), the result is zero (with the same sign)
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The smallest halfprecision float value toward negative infinity greater than or equal to the specified halfprecision float value 
compare
public static int compare (short x, short y)
Compares the two specified halfprecision float values. The following conditions apply during the comparison:
NaN
is considered by this method to be equal to itself and greater than all other halfprecision float values (including#POSITIVE_INFINITY
)POSITIVE_ZERO
is considered by this method to be greater thanNEGATIVE_ZERO
.
Parameters  

x 
short : The first halfprecision float value to compare. 
y 
short : The second halfprecision float value to compare 
Returns  

int 
The value 0 if x is numerically equal to y , a
value less than 0 if x is numerically less than y ,
and a value greater than 0 if x is numerically greater
than y

compareTo
public int compareTo (Half h)
Compares the two specified halfprecision float values. The following conditions apply during the comparison:
NaN
is considered by this method to be equal to itself and greater than all other halfprecision float values (including#POSITIVE_INFINITY
)POSITIVE_ZERO
is considered by this method to be greater thanNEGATIVE_ZERO
.
Parameters  

h 
Half : The halfprecision float value to compare to the halfprecision value
represented by this Half objectThis value must never be 
Returns  

int 
The value 0 if x is numerically equal to y ; a
value less than 0 if x is numerically less than y ;
and a value greater than 0 if x is numerically greater
than y

copySign
public static short copySign (short magnitude, short sign)
Returns the first parameter with the sign of the second parameter. This method treats NaNs as having a sign.
Parameters  

magnitude 
short : A halfprecision float value providing the magnitude of the result 
sign 
short : A halfprecision float value providing the sign of the result 
Returns  

short 
A value with the magnitude of the first parameter and the sign of the second parameter 
doubleValue
public double doubleValue ()
Returns the value of this Half
as a double
after
a widening primitive conversion.
Returns  

double 
The halfprecision float value represented by this object
converted to type double

equals
public static boolean equals (short x, short y)
Returns true if the two halfprecision float values are equal.
If either of the values is NaN, the result is false. POSITIVE_ZERO
and NEGATIVE_ZERO
are considered equal.
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

boolean 
True if x is equal to y, false otherwise 
equals
public boolean equals (Object o)
Compares this object against the specified object. The result is true
if and only if the argument is not null
and is a Half
object
that represents the same halfprecision value as the this object. Two
halfprecision values are considered to be the same if and only if the method
halfToIntBits(short)
returns an identical int
value for both.
Parameters  

o 
Object : The object to compareThis value may be 
Returns  

boolean 
True if the objects are the same, false otherwise 
See also:
floatValue
public float floatValue ()
Returns the value of this Half
as a float
after
a widening primitive conversion.
Returns  

float 
The halfprecision float value represented by this object
converted to type float

floor
public static short floor (short h)
Returns the largest halfprecision float value toward positive infinity less than or equal to the specified halfprecision float value. Special values are handled in the following ways:
 If the specified halfprecision float is NaN, the result is NaN
 If the specified halfprecision float is infinity (negative or positive), the result is infinity (with the same sign)
 If the specified halfprecision float is zero (negative or positive), the result is zero (with the same sign)
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The largest halfprecision float value toward positive infinity less than or equal to the specified halfprecision float value 
getExponent
public static int getExponent (short h)
Returns the unbiased exponent used in the representation of
the specified halfprecision float value. if the value is NaN
or infinite, this* method returns MAX_EXPONENT
+ 1.
If the argument is 0 or a subnormal representation, this method
returns MIN_EXPONENT
 1.
Parameters  

h 
short : A halfprecision float value 
Returns  

int 
The unbiased exponent of the specified value 
getSign
public static int getSign (short h)
Returns the sign of the specified halfprecision float.
Parameters  

h 
short : A halfprecision float value 
Returns  

int 
1 if the value is positive, 1 if the value is negative 
getSignificand
public static int getSignificand (short h)
Returns the significand, or mantissa, used in the representation of the specified halfprecision float value.
Parameters  

h 
short : A halfprecision float value 
Returns  

int 
The significand, or significand, of the specified vlaue 
greater
public static boolean greater (short x, short y)
Returns true if the first halfprecision float value is greater (larger toward positive infinity) than the second halfprecision float value. If either of the values is NaN, the result is false.
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

boolean 
True if x is greater than y, false otherwise 
greaterEquals
public static boolean greaterEquals (short x, short y)
Returns true if the first halfprecision float value is greater (larger toward positive infinity) than or equal to the second halfprecision float value. If either of the values is NaN, the result is false.
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

boolean 
True if x is greater than y, false otherwise 
halfToIntBits
public static int halfToIntBits (short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in Half
.
Unlike halfToRawIntBits(short)
, this method collapses all
possible NotaNumber values to a single canonical NotaNumber value
defined by NaN
.
Parameters  

h 
short : A halfprecision float value 
Returns  

int 
The bits that represent the halfprecision float value 
halfToRawIntBits
public static int halfToRawIntBits (short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in Half
.
The argument is considered to be a representation of a halfprecision
float value according to the bit layout described in Half
. The 16
most significant bits of the returned value are set to 0.
Parameters  

h 
short : A halfprecision float value 
Returns  

int 
The bits that represent the halfprecision float value 
See also:
halfToShortBits
public static short halfToShortBits (short h)
Returns a representation of the specified halfprecision float value
according to the bit layout described in Half
.
Similar to halfToIntBits(short)
, this method collapses all
possible NotaNumber values to a single canonical NotaNumber value
defined by NaN
.
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The bits that represent the halfprecision float value 
See also:
halfValue
public short halfValue ()
Returns the halfprecision value of this Half
as a short
containing the bit representation described in Half
.
Returns  

short 
The halfprecision float value represented by this object 
hashCode
public static int hashCode (short h)
Returns a hash code for a halfprecision float value.
Parameters  

h 
short : The value to hash 
Returns  

int 
A hash code value for a halfprecision float value 
hashCode
public int hashCode ()
Returns a hash code for this Half
object. The result is the
integer bit representation, exactly as produced by the method
halfToIntBits(short)
, of the primitive halfprecision float
value represented by this Half
object.
Returns  

int 
A hash code value for this object 
intBitsToHalf
public static short intBitsToHalf (int bits)
Returns the halfprecision float value corresponding to a given bit representation.
The argument is considered to be a representation of a halfprecision
float value according to the bit layout described in Half
. The 16
most significant bits of the argument are ignored.
Parameters  

bits 
int : An integer 
Returns  

short 
The halfprecision float value with the same bit pattern 
intValue
public int intValue ()
Returns the value of this Half
as a int
after
a narrowing primitive conversion.
Returns  

int 
The halfprecision float value represented by this object
converted to type int

isInfinite
public static boolean isInfinite (short h)
Returns true if the specified halfprecision float value represents infinity, false otherwise.
Parameters  

h 
short : A halfprecision float value 
Returns  

boolean 
True if the value is positive infinity or negative infinity, false otherwise 
isNaN
public boolean isNaN ()
Returns true if this Half
value represents a NotaNumber,
false otherwise.
Returns  

boolean 
True if the value is a NaN, false otherwise 
isNaN
public static boolean isNaN (short h)
Returns true if the specified halfprecision float value represents a NotaNumber, false otherwise.
Parameters  

h 
short : A halfprecision float value 
Returns  

boolean 
True if the value is a NaN, false otherwise 
isNormalized
public static boolean isNormalized (short h)
Returns true if the specified halfprecision float value is normalized
(does not have a subnormal representation). If the specified value is
POSITIVE_INFINITY
, NEGATIVE_INFINITY
,
POSITIVE_ZERO
, NEGATIVE_ZERO
, NaN or any subnormal
number, this method returns false.
Parameters  

h 
short : A halfprecision float value 
Returns  

boolean 
True if the value is normalized, false otherwise 
less
public static boolean less (short x, short y)
Returns true if the first halfprecision float value is less (smaller toward negative infinity) than the second halfprecision float value. If either of the values is NaN, the result is false.
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

boolean 
True if x is less than y, false otherwise 
lessEquals
public static boolean lessEquals (short x, short y)
Returns true if the first halfprecision float value is less (smaller toward negative infinity) than or equal to the second halfprecision float value. If either of the values is NaN, the result is false.
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

boolean 
True if x is less than or equal to y, false otherwise 
longValue
public long longValue ()
Returns the value of this Half
as a long
after
a narrowing primitive conversion.
Returns  

long 
The halfprecision float value represented by this object
converted to type long

max
public static short max (short x, short y)
Returns the larger of two halfprecision float values (the value closest to positive infinity). Special values are handled in the following ways:
 If either value is NaN, the result is NaN
POSITIVE_ZERO
is greater thanNEGATIVE_ZERO
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

short 
The larger of the two specified halfprecision values 
min
public static short min (short x, short y)
Returns the smaller of two halfprecision float values (the value closest to negative infinity). Special values are handled in the following ways:
 If either value is NaN, the result is NaN
NEGATIVE_ZERO
is smaller thanPOSITIVE_ZERO
Parameters  

x 
short : The first halfprecision value 
y 
short : The second halfprecision value 
Returns  

short 
The smaller of the two specified halfprecision values 
parseHalf
public static short parseHalf (String s)
Returns the halfprecision float value represented by the specified string.
Calling this method is equivalent to calling
toHalf(Float.parseString(h))
. See Float.valueOf(String)
for more information on the format of the string representation.
Parameters  

s 
String : The string to be parsedThis value must never be 
Returns  

short 
A halfprecision float value represented by the string 
Throws  

NumberFormatException 
if the string does not contain a parsable halfprecision float value 
round
public static short round (short h)
Returns the closest integral halfprecision float value to the specified halfprecision float value. Special values are handled in the following ways:
 If the specified halfprecision float is NaN, the result is NaN
 If the specified halfprecision float is infinity (negative or positive), the result is infinity (with the same sign)
 If the specified halfprecision float is zero (negative or positive), the result is zero (with the same sign)
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The value of the specified halfprecision float rounded to the nearest halfprecision float value 
shortValue
public short shortValue ()
Returns the value of this Half
as a short
after
a narrowing primitive conversion.
Returns  

short 
The halfprecision float value represented by this object
converted to type short

toFloat
public static float toFloat (short h)
Converts the specified halfprecision float value into a singleprecision float value. The following special cases are handled:
 If the input is
NaN
, the returned value isFloat.NaN
 If the input is
POSITIVE_INFINITY
orNEGATIVE_INFINITY
, the returned value is respectivelyFloat.POSITIVE_INFINITY
orFloat.NEGATIVE_INFINITY
 If the input is 0 (positive or negative), the returned value is +/0.0f
 Otherwise, the returned value is a normalized singleprecision float value
Parameters  

h 
short : The halfprecision float value to convert to singleprecision 
Returns  

float 
A normalized singleprecision float value 
toHalf
public static short toHalf (float f)
Converts the specified singleprecision float value into a halfprecision float value. The following special cases are handled:
 If the input is NaN (see
Float.isNaN(float)
), the returned value isNaN
 If the input is
Float.POSITIVE_INFINITY
orFloat.NEGATIVE_INFINITY
, the returned value is respectivelyPOSITIVE_INFINITY
orNEGATIVE_INFINITY
 If the input is 0 (positive or negative), the returned value is
POSITIVE_ZERO
orNEGATIVE_ZERO
 If the input is a less than
MIN_VALUE
, the returned value is flushed toPOSITIVE_ZERO
orNEGATIVE_ZERO
 If the input is a less than
MIN_NORMAL
, the returned value is a denorm halfprecision float  Otherwise, the returned value is rounded to the nearest representable halfprecision float value
Parameters  

f 
float : The singleprecision float value to convert to halfprecision 
Returns  

short 
A halfprecision float value 
toHexString
public static String toHexString (short h)
Returns a hexadecimal string representation of the specified halfprecision
float value. If the value is a NaN, the result is "NaN"
,
otherwise the result follows this format:
 If the sign is positive, no sign character appears in the result
 If the sign is negative, the first character is
''
 If the value is inifinity, the string is
"Infinity"
 If the value is 0, the string is
"0x0.0p0"
 If the value has a normalized representation, the exponent and
significand are represented in the string in two fields. The significand
starts with
"0x1."
followed by its lowercase hexadecimal representation. Trailing zeroes are removed unless all digits are 0, then a single zero is used. The significand representation is followed by the exponent, represented by"p"
, itself followed by a decimal string of the unbiased exponent  If the value has a subnormal representation, the significand starts
with
"0x0."
followed by its lowercase hexadecimal representation. Trailing zeroes are removed unless all digits are 0, then a single zero is used. The significand representation is followed by the exponent, represented by"p14"
Parameters  

h 
short : A halfprecision float value 
Returns  

String 
A hexadecimal string representation of the specified value
This value will never be 
toString
public static String toString (short h)
Returns a string representation of the specified halfprecision
float value. Calling this method is equivalent to calling
Float.toString(toFloat(h))
. See Float.toString(float)
for more information on the format of the string representation.
Parameters  

h 
short : A halfprecision float value 
Returns  

String 
A string representation of the specified value
This value will never be 
toString
public String toString ()
Returns a string representation of the specified halfprecision
float value. See toString(short)
for more information.
Returns  

String 
A string representation of this Half object
This value will never be 
trunc
public static short trunc (short h)
Returns the truncated halfprecision float value of the specified halfprecision float value. Special values are handled in the following ways:
 If the specified halfprecision float is NaN, the result is NaN
 If the specified halfprecision float is infinity (negative or positive), the result is infinity (with the same sign)
 If the specified halfprecision float is zero (negative or positive), the result is zero (with the same sign)
Parameters  

h 
short : A halfprecision float value 
Returns  

short 
The truncated halfprecision float value of the specified halfprecision float value 
valueOf
public static Half valueOf (String s)
Returns a Half
instance representing the specified string value.
Calling this method is equivalent to calling
toHalf(Float.parseString(h))
. See Float.valueOf(String)
for more information on the format of the string representation.
Parameters  

s 
String : The string to be parsedThis value must never be 
Returns  

Half 
a Half instance representing h This value will never be 
Throws  

NumberFormatException 
if the string does not contain a parsable halfprecision float value 
valueOf
public static Half valueOf (float f)
Returns a Half
instance representing the specified float value.
Parameters  

f 
float : A float value 
Returns  

Half 
a Half instance representing f
This value will never be 
valueOf
public static Half valueOf (short h)
Returns a Half
instance representing the specified
halfprecision float value.
Parameters  

h 
short : A halfprecision float value 
Returns  

Half 
a Half instance representing h
This value will never be 
Interfaces
Classes
 ArrayMap
 ArraySet
 AtomicFile
 Base64
 Base64InputStream
 Base64OutputStream
 Config
 DebugUtils
 DisplayMetrics
 EventLog
 EventLog.Event
 EventLogTags
 EventLogTags.Description
 FloatMath
 FloatProperty
 Half
 IntProperty
 JsonReader
 JsonWriter
 LayoutDirection
 Log
 LogPrinter
 LongSparseArray
 LruCache
 MonthDisplayHelper
 MutableBoolean
 MutableByte
 MutableChar
 MutableDouble
 MutableFloat
 MutableInt
 MutableLong
 MutableShort
 Pair
 Patterns
 PrintStreamPrinter
 PrintWriterPrinter
 Property
 Range
 Rational
 Size
 SizeF
 SparseArray
 SparseBooleanArray
 SparseIntArray
 SparseLongArray
 StateSet
 StatsLog
 StringBuilderPrinter
 TimeUtils
 TimingLogger
 TypedValue
 Xml
Enums
Exceptions