src/share/classes/java/lang/Byte.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


 477      * input plus 2<sup>8</sup>.
 478      *
 479      * @param  x the value to convert to an unsigned {@code long}
 480      * @return the argument converted to {@code long} by an unsigned
 481      *         conversion
 482      * @since 1.8
 483      */
 484     public static long toUnsignedLong(byte x) {
 485         return ((long) x) & 0xffL;
 486     }
 487 
 488 
 489     /**
 490      * The number of bits used to represent a {@code byte} value in two's
 491      * complement binary form.
 492      *
 493      * @since 1.5
 494      */
 495     public static final int SIZE = 8;
 496 








 497     /** use serialVersionUID from JDK 1.1. for interoperability */
 498     private static final long serialVersionUID = -7183698231559129828L;
 499 }


 477      * input plus 2<sup>8</sup>.
 478      *
 479      * @param  x the value to convert to an unsigned {@code long}
 480      * @return the argument converted to {@code long} by an unsigned
 481      *         conversion
 482      * @since 1.8
 483      */
 484     public static long toUnsignedLong(byte x) {
 485         return ((long) x) & 0xffL;
 486     }
 487 
 488 
 489     /**
 490      * The number of bits used to represent a {@code byte} value in two's
 491      * complement binary form.
 492      *
 493      * @since 1.5
 494      */
 495     public static final int SIZE = 8;
 496 
 497     /**
 498      * The number of bytes used to represent a {@code byte} value in two's
 499      * complement binary form.
 500      *
 501      * @since 1.8
 502      */
 503     public static final int BYTES = SIZE / Byte.SIZE;
 504 
 505     /** use serialVersionUID from JDK 1.1. for interoperability */
 506     private static final long serialVersionUID = -7183698231559129828L;
 507 }