title: Reverse digits of an integer
body: <p>how to reverse a number?</p>
  
  <p>Example1: x = 123, return 321
  Example2: x = -123, return -321 </p>
  
  <p>this is my answer:</p>
  
  <pre><code>public int reverse(int x) {
      int result = 0;
      while(x != 0){
          result = result * 10 + x % 10;
          x = x / 10;
      }
      return result;
  }
  </code></pre>
  
  <p>but when I input 1534236469 , it will output 1056389759 , this is wrong. what do you think about my program? thanks.</p>