title: String to binary and vice versa: extended ASCII
body: <p>I want to convert a String to binary by putting it in a byte array (<code>String.getBytes[]</code>) and then store the binary string for each byte (<code>Integer.toBinaryString(bytearray)</code>) in a String[]. Then I want to convert back to normal String via <code>Byte.parseByte(stringarray[i], 2)</code>. This works great for standard ASCII-Table, but not for the extended one. For example, an <code>A</code> gives me <code>1000001</code>, but an <code>Ä</code> returns </p>
  
  <pre><code>11111111111111111111111111000011
  11111111111111111111111110000100
  </code></pre>
  
  <p>Any ideas how to manage this?</p>
  
  <pre><code>public class BinString {
      public static void main(String args[]) {
          String s = "ä";
          System.out.println(binToString(stringToBin(s)));
  
      }
  
      public static String[] stringToBin(String s) {
          System.out.println("Converting: " + s);
          byte[] b = s.getBytes();
          String[] sa = new String[s.getBytes().length];
          for (int i = 0; i &lt; b.length; i++) {
              sa[i] = Integer.toBinaryString(b[i] &amp; 0xFF);
          }
          return sa;
      }
  
      public static String binToString(String[] strar) {
          byte[] bar = new byte[strar.length];
          for (int i = 0; i &lt; strar.length; i++) {
              bar[i] = Byte.parseByte(strar[i], 2);
              System.out.println(Byte.parseByte(strar[i], 2));
  
          }
          String s = new String(bar);
          return s;
      }
  
  }
  </code></pre>