title: How to convert A string that represents an integer to unsigned byte array in Java?
body: <p>Basically, what I want is to convert a string like <code>"123456"</code> to unsigned byte array: <code>[1, 226, 64]</code>. However, I look everywhere and what I found is to get the 2's complements (signed) byte array <code>[1, -30, 64]</code>:</p>
  
  <pre><code>byte[] array = new BigInteger("123456").toByteArray();
  System.out.println(Arrays.toString(array));
  </code></pre>
  
  <p><strong>OUTPUT:</strong></p>
  
  <pre><code>[1, -30, 64]
  </code></pre>
  
  <p>So, how can it be done in Java? I want the output to be:</p>
  
  <pre><code>[1, 226, 64]
  </code></pre>
  
  <p><strong>EDIT:</strong> I know that byte can hold only up to 127, so instead of byte array I need it to be int array.</p>