title: Integer to Binary in scala
body: <p>Just for kicks I decided to write a snippet that takes an integer and converts it into binary. It seems to be performing the conversion but I was wondering if there's anything that I might be missing from this. It will be great to get some feedback.</p>
  
  <p>Thanks</p>
  
  <pre><code>def convertToBinary(n: Int, bin: List[Int]): String = {
    if(n/2 == 1) {
      (1::(n%2)::bin).mkString(" ")
    } else {
       val r = n%2;val q = n/2;converttobinary(q,r::bin)
    }
  }
  </code></pre>