home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / lang / Float.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  2.0 KB  |  75 lines

  1. package java.lang;
  2.  
  3. public final class Float extends Number {
  4.    public static final float POSITIVE_INFINITY = InfinityF;
  5.    public static final float NEGATIVE_INFINITY = -InfinityF;
  6.    public static final float NaN = NaNF;
  7.    public static final float MAX_VALUE = 3.4028235E38F;
  8.    public static final float MIN_VALUE = 1.4E-45F;
  9.    private float value;
  10.  
  11.    public static native String toString(float var0);
  12.  
  13.    public static native Float valueOf(String var0) throws NumberFormatException;
  14.  
  15.    public static boolean isNaN(float v) {
  16.       return v != v;
  17.    }
  18.  
  19.    public static boolean isInfinite(float v) {
  20.       return v == POSITIVE_INFINITY || v == NEGATIVE_INFINITY;
  21.    }
  22.  
  23.    public Float(float value) {
  24.       this.value = value;
  25.    }
  26.  
  27.    public Float(double value) {
  28.       this.value = (float)value;
  29.    }
  30.  
  31.    public Float(String s) throws NumberFormatException {
  32.       this(valueOf(s));
  33.    }
  34.  
  35.    public boolean isNaN() {
  36.       return isNaN(this.value);
  37.    }
  38.  
  39.    public boolean isInfinite() {
  40.       return isInfinite(this.value);
  41.    }
  42.  
  43.    public String toString() {
  44.       return String.valueOf(this.value);
  45.    }
  46.  
  47.    public int intValue() {
  48.       return (int)this.value;
  49.    }
  50.  
  51.    public long longValue() {
  52.       return (long)this.value;
  53.    }
  54.  
  55.    public float floatValue() {
  56.       return this.value;
  57.    }
  58.  
  59.    public double doubleValue() {
  60.       return (double)this.value;
  61.    }
  62.  
  63.    public int hashCode() {
  64.       return floatToIntBits(this.value);
  65.    }
  66.  
  67.    public boolean equals(Object obj) {
  68.       return obj != null && obj instanceof Float && floatToIntBits(((Float)obj).value) == floatToIntBits(this.value);
  69.    }
  70.  
  71.    public static native int floatToIntBits(float var0);
  72.  
  73.    public static native float intBitsToFloat(int var0);
  74. }
  75.