title: What is wrong with my recursive method for getting binary from int?
body: <p>So I am supposed to make a method that takes in an integer and recursively creates a string that is the representation in binary form. Here is what I have so far. It does not work correctly. When I pass in the number 13, I receive a "1" as the result instead of "1101"</p>
  
  <pre><code>public String convBinary(int n) {
     if( n &lt; 0)
         throw new IllegalArgumentException("Failed precondition: convBinary. n must be &gt;= 0. n: " + n);
  
     String result="";
  
     if(n&lt;2){
         result=Integer.toString(n);
         return result;
     }
     else{
         if(n!=0){
  
             convBinary((n/2));
             result+=Integer.toString(n%2);
         }
     }
     return result; 
  }
  </code></pre>