title: decimal to binary 8 bits only using append
body: <p>I'm having a trouble converting decimal to binary. How to convert binary using string Builder in adding 0's from the start?</p>
  
  <pre><code>while (num != 0){    
    int digit = num % 2;
  
    buf.append(digit);
    num = num/2;
  }   
  
  System.out.println(num);
  </code></pre>