title: simple way of writing a binary code?
body: <p>Need a way to write this in java without parse conversions. (Turns a number into binary)
  Whats a simple way of writing this? "public static String toBinary(String num)"</p>
  
  <p>Given a decimal integer D:</p>
  
  <p>1) Divide D by 2, separating the remainder (remember, these are integers)</p>
  
  <p>2) Always inserting to the LEFT of any previous binary digits in the answer, if there is no remainder, insert a 0, otherwise insert a 1.</p>
  
  <p>3) repeat steps 1 &amp; 2 until D is 0</p>
  
  <p>Example:</p>
  
  <p>If D = 49:</p>
  
  <p>49/2 = 24 remainder 1, so insert a 1 into the answer: 1</p>
  
  <p>24/2 = 12 remainder 0, so insert a 0 into the answer: 01</p>
  
  <p>12/2 = 6 remainder 0, so insert a 0 into the answer: 001</p>
  
  <p>6/2 = 3 remainder 0, so insert a 0 into the answer: 0001</p>
  
  <p>3/2 = 1 remainder 1, so insert a 1 into the answer: 10001</p>
  
  <p>1/2 = 0 remainder 1, so insert a 1 into the answer: 110001</p>
  
  <p>D = 0, so the answer is 110001</p>