title: convert a hex string to a binary string in byte throws NumberFormatException
body: <pre><code>public static byte[][] keyArray = new byte[4][4]; 
  String hex = "93";
  String hexInBinary = Integer.toBinaryString(Integer.parseInt(hex, 16));
  keyArray[row][col] = Byte.parseByte(hexInBinary,2); //this line causes the error
  </code></pre>
  
  <p>This is the error message I get, </p>
  
  <pre><code>"Exception in thread "main" java.lang.NumberFormatException: Value out of range. Value:"10010011" Radix:2."
  </code></pre>
  
  <p>I don't want to use getBytes(), because I actually have a long string, "0A935D11496532BC1004865ABDCA42950." I want to read 2 hex at a time and convert to byte.</p>
  
  <p>EDIT:</p>
  
  <p>how I fixed it:</p>
  
  <pre><code>String hexInBinary = String.format("%8s", Integer.toBinaryString(Integer.parseInt(hex, 16))).replace(' ', '0');
  keyArray[row][col] = (byte)Integer.parseInt(hexInBinary, 2);
  </code></pre>