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: dholmes
diff --git a/src/share/classes/java/lang/Byte.java b/src/share/classes/java/lang/Byte.java
index c4dd62e..43a558a 100644
--- a/src/share/classes/java/lang/Byte.java
+++ b/src/share/classes/java/lang/Byte.java
@@ -507,6 +507,14 @@
      */
     public static final int SIZE = 8;
 
+    /**
+     * The number of bytes used to represent a {@code byte} value in two's
+     * complement binary form.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
     /** use serialVersionUID from JDK 1.1. for interoperability */
     private static final long serialVersionUID = -7183698231559129828L;
 }
diff --git a/src/share/classes/java/lang/Character.java b/src/share/classes/java/lang/Character.java
index 03134d0..0f44006 100644
--- a/src/share/classes/java/lang/Character.java
+++ b/src/share/classes/java/lang/Character.java
@@ -7171,6 +7171,14 @@
     public static final int SIZE = 16;
 
     /**
+     * The number of bytes used to represent a {@code char} value in unsigned
+     * binary form.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * Returns the value obtained by reversing the order of the bytes in the
      * specified <tt>char</tt> value.
      *
diff --git a/src/share/classes/java/lang/Double.java b/src/share/classes/java/lang/Double.java
index 040cca7..a20f79e 100644
--- a/src/share/classes/java/lang/Double.java
+++ b/src/share/classes/java/lang/Double.java
@@ -123,6 +123,13 @@
     public static final int SIZE = 64;
 
     /**
+     * The number of bytes used to represent a {@code double} value.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * The {@code Class} instance representing the primitive type
      * {@code double}.
      *
diff --git a/src/share/classes/java/lang/Float.java b/src/share/classes/java/lang/Float.java
index 1e8f6e3..0c071e2 100644
--- a/src/share/classes/java/lang/Float.java
+++ b/src/share/classes/java/lang/Float.java
@@ -121,6 +121,13 @@
     public static final int SIZE = 32;
 
     /**
+     * The number of bytes used to represent a {@code float} value.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * The {@code Class} instance representing the primitive type
      * {@code float}.
      *
diff --git a/src/share/classes/java/lang/Integer.java b/src/share/classes/java/lang/Integer.java
index 50627e9..3496d03 100644
--- a/src/share/classes/java/lang/Integer.java
+++ b/src/share/classes/java/lang/Integer.java
@@ -1298,6 +1298,14 @@
     public static final int SIZE = 32;
 
     /**
+     * The number of bytes used to represent a {@code int} value in two's
+     * complement binary form.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * Returns an {@code int} value with at most a single one-bit, in the
      * position of the highest-order ("leftmost") one-bit in the specified
      * {@code int} value.  Returns zero if the specified value has no
diff --git a/src/share/classes/java/lang/Long.java b/src/share/classes/java/lang/Long.java
index 9197a6d..6509f88 100644
--- a/src/share/classes/java/lang/Long.java
+++ b/src/share/classes/java/lang/Long.java
@@ -1320,6 +1320,14 @@
     public static final int SIZE = 64;
 
     /**
+     * The number of bytes used to represent a {@code long} value in two's
+     * complement binary form.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * Returns a {@code long} value with at most a single one-bit, in the
      * position of the highest-order ("leftmost") one-bit in the specified
      * {@code long} value.  Returns zero if the specified value has no
diff --git a/src/share/classes/java/lang/Short.java b/src/share/classes/java/lang/Short.java
index f117095..6042b13 100644
--- a/src/share/classes/java/lang/Short.java
+++ b/src/share/classes/java/lang/Short.java
@@ -471,6 +471,14 @@
     public static final int SIZE = 16;
 
     /**
+     * The number of bytes used to represent a {@code short} value in two's
+     * complement binary form.
+     *
+     * @since 1.8
+     */
+    public static final int BYTES = SIZE / Byte.SIZE;
+
+    /**
      * Returns the value obtained by reversing the order of the bytes in the
      * two's complement representation of the specified {@code short} value.
      *