title: Remove all numbers except the first using recursion
body: <p>Basically what I have to do is to remove all digits and leave the first one. If it's a number under 10 keep that number.</p>
  
  <p>I already made some code but instead of removing all digits following the first, I removed the first digit.</p>
  
  <p>My code:</p>
  
  <pre><code>public static int keepFirstDigit(int num) {
    // Can't change anything besides the following code
    if(num==0){
      return 0;
    }
    if(num&gt;0){
      return num % (int) Math.pow(10, (int) Math.log10(num));
    }
    return num;
  }
  </code></pre>
  
  <p>If the number is 5, the output should be 5.<br>
  If the number is 23 the output should be 2.<br>
  If the number is 62363456 the output should be 6.</p>