Float class

                             
    java.lang.Object                        
     |                       
     |--java.lang.Number                    
         |                   
         |--java.lang.Float                
                             

Float class wraps a value of type float in an object.

Field Summary

TypeFieldSummary
static intMAX_EXPONENTMaximum exponent a finite float.
static floatMAX_VALUELargest positive finite value of type float.
static intMIN_EXPONENTMinimum exponent a normalized float variable may have.
static floatMIN_NORMALSmallest positive normal value of type float.
static floatMIN_VALUESmallest positive nonzero value of type float.
static floatNaNNot-a-Number (NaN) value of type float.
static floatNEGATIVE_INFINITYNegative infinity of type float.
static floatPOSITIVE_INFINITYPositive infinity of type float.
static intSIZEThe number of bits used to represent a float value.
static ClassTYPEThe Class instance representing the primitive type float.

ConstructorSummary
Float(double value)Creates a Float from double-type value.
Float(float value)Creates a Float for the float argument.
Float(String s)Creates a Float from a float represented by the string.

Convert to byte, double, float, int, long and short

ReturnMethodSummary
bytebyteValue()Returns this float as a byte.
doubledoubleValue()Returns the double value.
floatfloatValue()Returns the float value.
intintValue()Returns this float as an int by casting to type int.
longlongValue()Returns this float as a long.
shortshortValue()Returns this float as a short by casting.

Compare two float objects

ReturnMethodSummary
static intcompare(float f1, float f2)Compares the two specified float values.
intcompareTo(Float anotherFloat)Compares two Float objects numerically.
booleanequals(Object obj)Compares this object against the specified object.

Infinite and Not A Number

ReturnMethodSummary
booleanisInfinite()Returns true if this Float value is infinitely large in magnitude, false otherwise.
static booleanisInfinite(float v)Returns true if the specified number is infinitely large in magnitude, false otherwise.
booleanisNaN()Returns true if this Float value is a Not-a-Number (NaN), false otherwise.
static booleanisNaN(float v)Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Convert float value to String value

ReturnMethodSummary
static StringtoHexString(float f)Returns a hexadecimal string representation of the float argument.
StringtoString()Returns a string representation of this Float object.
static StringtoString(float f)Returns a string representation of the float argument.

Convert string value to float value

ReturnMethodSummary
static floatparseFloat(String s)Returns a new float initialized to the value represented by the specified String.
static FloatvalueOf(float f)Returns a Float instance representing the specified float value.
static FloatvalueOf(String s)Returns a Float object holding the float value represented by the argument string s.

Bit oriented

ReturnMethodSummary
static intfloatToIntBits(float value)Returns a representation of the specified floating-point value.
static intfloatToRawIntBits(float value)Returns a representation of the specified floating-point value.
static floatintBitsToFloat(int bits)Returns the float value corresponding to a given bit representation.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.