src/share/classes/java/lang/Float.java

Print this page
rev 6091 : 7088952: Add size in bytes constant "BYTES" to primitive type wrapper types
Summary: Adds a constant BYTES to each of the primitive wrapper classes (Byte, Character, Double, Float, Integer, Long, Short) with the calculation Primitive.SIZE / Byte.SIZE already made.
Reviewed-by: smarks, darcy


 104      */
 105     public static final int MAX_EXPONENT = 127;
 106 
 107     /**
 108      * Minimum exponent a normalized {@code float} variable may have.
 109      * It is equal to the value returned by {@code
 110      * Math.getExponent(Float.MIN_NORMAL)}.
 111      *
 112      * @since 1.6
 113      */
 114     public static final int MIN_EXPONENT = -126;
 115 
 116     /**
 117      * The number of bits used to represent a {@code float} value.
 118      *
 119      * @since 1.5
 120      */
 121     public static final int SIZE = 32;
 122 
 123     /**







 124      * The {@code Class} instance representing the primitive type
 125      * {@code float}.
 126      *
 127      * @since JDK1.1
 128      */
 129     @SuppressWarnings("unchecked")
 130     public static final Class<Float> TYPE = (Class<Float>) Class.getPrimitiveClass("float");
 131 
 132     /**
 133      * Returns a string representation of the {@code float}
 134      * argument. All characters mentioned below are ASCII characters.
 135      * <ul>
 136      * <li>If the argument is NaN, the result is the string
 137      * "{@code NaN}".
 138      * <li>Otherwise, the result is a string that represents the sign and
 139      *     magnitude (absolute value) of the argument. If the sign is
 140      *     negative, the first character of the result is
 141      *     '{@code -}' ({@code '\u005Cu002D'}); if the sign is
 142      *     positive, no sign character appears in the result. As for
 143      *     the magnitude <i>m</i>:




 104      */
 105     public static final int MAX_EXPONENT = 127;
 106 
 107     /**
 108      * Minimum exponent a normalized {@code float} variable may have.
 109      * It is equal to the value returned by {@code
 110      * Math.getExponent(Float.MIN_NORMAL)}.
 111      *
 112      * @since 1.6
 113      */
 114     public static final int MIN_EXPONENT = -126;
 115 
 116     /**
 117      * The number of bits used to represent a {@code float} value.
 118      *
 119      * @since 1.5
 120      */
 121     public static final int SIZE = 32;
 122 
 123     /**
 124      * The number of bytes used to represent a {@code float} value.
 125      *
 126      * @since 1.8
 127      */
 128     public static final int BYTES = SIZE / Byte.SIZE;
 129 
 130     /**
 131      * The {@code Class} instance representing the primitive type
 132      * {@code float}.
 133      *
 134      * @since JDK1.1
 135      */
 136     @SuppressWarnings("unchecked")
 137     public static final Class<Float> TYPE = (Class<Float>) Class.getPrimitiveClass("float");
 138 
 139     /**
 140      * Returns a string representation of the {@code float}
 141      * argument. All characters mentioned below are ASCII characters.
 142      * <ul>
 143      * <li>If the argument is NaN, the result is the string
 144      * "{@code NaN}".
 145      * <li>Otherwise, the result is a string that represents the sign and
 146      *     magnitude (absolute value) of the argument. If the sign is
 147      *     negative, the first character of the result is
 148      *     '{@code -}' ({@code '\u005Cu002D'}); if the sign is
 149      *     positive, no sign character appears in the result. As for
 150      *     the magnitude <i>m</i>: