title: Java: convert binary string to hex string
body: <p>I need to convert the binary string to a hex string but i have a problem.
  I  converted the binary string to a hex string by this method:</p>
  
  <pre><code>public static String binaryToHex(String bin){
     return Long.toHexString(Long.parseLong(bin,2));
  }
  </code></pre>
  
  <p>it's ok! but I lose the zeros to the left of the string.
  Ex:</p>
  
  <p>the method return this: 123456789ABCDEF,
  but i want returned this:</p>
  
  <p>00000123456789ABCDEF</p>