title: Why in JVM Integer is stored as byte and short?
body: <p>Here is one snippet of code </p>
  
  <pre><code>public class Classifier {
      public static void main(String[] args) 
      {
          Integer x = -127;//this uses bipush
          Integer y = 127;//this use bipush
          Integer z= -129;//this use sipush
          Integer p=32767;//maximum range of short still sipush
          Integer a = 128; // use sipush
          Integer b = 129786;// invokes virtual method to get Integer class
  
      }
  
  }
  </code></pre>
  
  <p>Here is partial byte code of this </p>
  
  <pre><code>      stack=1, locals=7, args_size=1
           0: bipush        -127
           2: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
           5: astore_1
           6: bipush        127
           8: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
          11: astore_2
          12: sipush        -129
          15: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
          18: astore_3
          19: sipush        32767
          22: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
          25: astore        4
          27: sipush        128
          30: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
          33: astore        5
          35: ldc           #22                 // int 129786
          37: invokestatic  #16                 // Method java/lang/Integer.valueO
  f:(I)Ljava/lang/Integer;
          40: astore        6
          42: return
  </code></pre>
  
  <p>As i see for Integer range between <code>-128 to 127</code> it uses <code>bipush</code> which push a byte onto the stack as an integer value.
  In a range <code>-32768 to 32767</code> it uses <code>short</code> as a wrapper class as <code>sipush</code>. For next it uses Integer. What JVM uses byte and short to store Integer value?</p>