title: convert bit array values into a string of binary numbers
body: <p><strong>Just look at lower part now</strong></p>
  
  <p>I've seen on here before ways to convert hex to binary, but my question is: is it possible to convert hex values inside of a byte array into binary values and put it into a big string?</p>
  
  <p>The code I've been working on so far is:</p>
  
  <pre><code>public static void main (String[] args){
  
      byte [] ex;
      ex = new byte [] {(byte)0xFF, (byte)0x11, (byte)0xEE, (byte)0x22, (byte)0xDD, (byte)0x33, (byte)0xCC, (byte)0x44};
      printByteArray(ex);
  
  }
  
  public static void printByteArray(byte [] array)
  
  
  {
      System.out.print("[  ");
      for(int i = 0; i &lt; array.length; i++)
      {
          System.out.print(Integer.toHexString((array[i]&gt;&gt;4)&amp;0x0F).toUpperCase());
          System.out.print(Integer.toHexString(array[i]&amp;0x0F).toUpperCase() + "  ");
      }
      System.out.println( "]");
  }
  </code></pre>
  
  <p>What I want is to change is to be able to put the whole binary string into a byte array, i.e., to get the binary values for each hex number and then put it all into on HUGE byte array.</p>
  
  <p><strong>EDITED</strong></p>
  
  <p>Okay well I'm going with the first one it doesn't matter all that much I guess how long they are, they were still correct. But now could you just help me take and use that string. I have this code :</p>
  
  <pre><code>public static void main (String[] args){
  
      String binary;
      byte [] ex;
      ex = new byte [] {(byte)0xFF, (byte)0x11, (byte)0xEE, (byte)0x22, (byte)0xDD, (byte)0x33, (byte)0xCC, (byte)0x44};
      printByteArray(ex);
      binary = hexToBin(ex);
      System.out.println(binary);
  
  }
  
  public static String hexToBin(byte [] array)
  {
      String binStr = null;
      for(int i = 0; i &lt; array.length; i++){
          binStr.append(Integer.toBinaryString(array[i]));
      }
      return binStr;
  }
  </code></pre>
  
  <p>... but due to the fact of how I initialized the string (at first) my output has <code>null</code> in it. Any ideas how to fix that? Also I just changed it to append and now I don't know why but won't let me use it? </p>