title: Print a short in binary format in Java
body: <p>Is there any builtin support for outputting a binary representation of a short in java?</p>
  
  <p>There is of course, <a href="https://stackoverflow.com/questions/5263187/print-an-integer-in-binary-format-in-java">this</a>, which recommends the use of Integer.toBinaryString(), which works.  There is no comparable Short.toBinaryString().  Is anything else available?</p>
  
  <p><strong>Update:</strong>
  Integer.toBinaryString() doesn't quite work the way Short.toBinaryString() would work if it existed.</p>
  
  <pre><code>public static void main(String[] args) {
      System.out.println(Integer.toBinaryString(Short.MIN_VALUE));
  }
  </code></pre>
  
  <p>produces</p>
  
  <pre><code>11111111111111111000000000000000
  </code></pre>
  
  <p>whereas I would like to see</p>
  
  <pre><code>1000000000000000
  </code></pre>
  
  <p>Of course, it's easy enough to chop off the first 16 digits, but that's kind of my point.  This method ought to exist.</p>