|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Object
|
+--java.lang.Number
|
+--java.lang.Float
Floats are objects (non-base types) which represent float values.
| Field Summary | |
|---|---|
static float |
MAX_VALUE
Largest and smallest possible float values. |
static float |
MIN_VALUE
|
static float |
NaN
A value which represents all invalid float results (NaN ==> Not a Number) |
static float |
NEGATIVE_INFINITY
|
static float |
POSITIVE_INFINITY
Values to represent infinite results |
static Class |
TYPE
The java.lang.Class that represents this class. |
| Constructor Summary | |
|---|---|
Float(double value)
Constructs a new instance of the receiver which represents the double valued argument. |
|
Float(float value)
Constructs a new instance of the receiver which represents the float valued argument. |
|
Float(String string)
Constructs a new instance of this class given a string. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Answers the byte value which the receiver represents |
static int |
compare(float float1,
float float2)
Compares the two floats. |
int |
compareTo(Float object)
Compares the receiver with the Float parameter. |
int |
compareTo(Object object)
Compares the receiver with a Float parameter. |
double |
doubleValue()
Answers the double value which the receiver represents |
boolean |
equals(Object object)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. |
static int |
floatToIntBits(float value)
Answers the binary representation of the argument, as an int. |
static int |
floatToRawIntBits(float value)
Answers the binary representation of the argument, as an int. |
float |
floatValue()
Answers the receiver's value as a float. |
int |
hashCode()
Answers an integer hash code for the receiver. |
static float |
intBitsToFloat(int bits)
Answers a float built from the binary representation given in the argument. |
int |
intValue()
Answers the int value which the receiver represents |
boolean |
isInfinite()
Answers true if the receiver represents an infinite quantity, and false otherwise. |
static boolean |
isInfinite(float f)
Answers true if the argument represents an infinite quantity, and false otherwise. |
boolean |
isNaN()
Answers true if the receiver does not represent a valid float quantity. |
static boolean |
isNaN(float f)
Answers true if the argument does not represent a valid float quantity. |
long |
longValue()
Answers the long value which the receiver represents |
static float |
parseFloat(String string)
Answers the float which matches the passed in string. |
short |
shortValue()
Answers the short value which the receiver represents |
String |
toString()
Answers a string containing a concise, human-readable description of the receiver. |
static String |
toString(float f)
Answers a string containing a printable representation of the argument. |
static Float |
valueOf(String string)
Answers the float which matches the passed in string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final float MAX_VALUE
public static final float MIN_VALUE
public static final float NaN
public static final float POSITIVE_INFINITY
public static final float NEGATIVE_INFINITY
public static final Class TYPE
| Constructor Detail |
public Float(float value)
value - the float to store in the new instance.public Float(double value)
value - the double to store in the new instance.public Float(String string)
throws NumberFormatException
string - a string representation of a
float quantity.
NumberFormatException - if the argument could not be parsed
as a float quantity.| Method Detail |
public int compareTo(Float object)
object - the Float to compare to the receiver
public int compareTo(Object object)
compareTo in interface Comparableobject - the Float to compare to the receiver
ClassCastException - when object is not a FloatcompareTo(Float)public byte byteValue()
byteValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic boolean equals(Object object)
equals in class Objectobject - the object to compare with this object
true
if the object is the same as this object
false
if it is different from this objecthashCode()public static int floatToIntBits(float value)
value - The float value to convert
public static int floatToRawIntBits(float value)
value - The float value to convert
public float floatValue()
floatValue in class Numberpublic int hashCode()
true when passed to
equals must answer the same value for this
method.
hashCode in class Objectequals(java.lang.Object)public static float intBitsToFloat(int bits)
bits - the bits of the float
public int intValue()
intValue in class Numberpublic boolean isInfinite()
true
if the argument is positive or negative infinity
false
if it is not an infinite valuepublic static boolean isInfinite(float f)
f - value to check for infinitness.
true
if the argument is positive or negative infinity
false
if it is not an infinite valuepublic boolean isNaN()
true
if the argument is Not A Number
false
if it is a (potentially infinite) float numberpublic static boolean isNaN(float f)
f - value to check for numberness.
true
if the argument is Not A Number
false
if it is a (potentially infinite) float numberpublic long longValue()
longValue in class Numberpublic static float parseFloat(String string)
throws NumberFormatException
string - the value to convert
NumberFormatExceptionpublic short shortValue()
shortValue in class Numberpublic String toString()
toString in class Objectpublic static String toString(float f)
f - the float to print
public static Float valueOf(String string)
throws NumberFormatException
string - the value to convert
NumberFormatExceptionpublic static int compare(float float1,
float float2)
float1 - the first value to comparefloat2 - the second value to compare
|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||