title: Pad a binary String equal to zero ("0") with leading zeros in Java
body: <pre><code>Integer.toBinaryString(data)
  </code></pre>
  
  <p>gives me a binary String representation of my array data. </p>
  
  <p>However I would like a simple way to add leading zeros to it, since a byte array equal to zero gives me a "0" String.</p>
  
  <p>I'd like a one-liner like this:</p>
  
  <pre><code>String dataStr = Integer.toBinaryString(data).equals("0") ? String.format(format, Integer.toBinaryString(data)) : Integer.toBinaryString(data);
  </code></pre>
  
  <p>Is <code>String.format()</code> the correct approach? If yes, what <code>format</code> String should I use?
  Thanks in advance!</p>
  
  <p>Edit: The <code>data</code> array is of dynamic length, so should the number of leading zeros.</p>