title: Why am i getting 3 bytes instead 1 byte after hexadecimal/string/byte conversion in java?
body: <p>I have this program:</p>
  
  <pre><code>    String hexadecimal = "AF";
      byte decimal[] = new byte[hexadecimal.length()/2];
  
      int j = 0;
      for ( int i = 0; i &lt; decimal.length; i++)
      {
          decimal[i] = (byte) Integer.parseInt(hexadecimal.substring(j,j+2),16); //Maybe the problem is this statement
          j = j + 2;
      }
  
      String s = new String(decimal);
      System.out.println("TOTAL LEN: " + s.length());
  
      byte aux[] = s.getBytes();
      System.out.println("TOTAL LEN: " + aux.length);
  </code></pre>
  
  <p>The first total is "1" and the second one is "3", i thought i would will get "1" in the second total. Why is happen this? My intention is generate another hexadecimal string with the same value as the original string (AF), but i am having this issue. </p>
  
  <p>Regards!</p>
  
  <p>P.D. Sorry for my english, let me know if i explained myself well.</p>