title: Writing a method that returns the last digit of an integer
body: <p>I'm given the following task, and can do it if I can use a string-</p>
  
  <blockquote>
    <p>Write a method named <code>lastDigit</code> that returns the last digit of an integer. For example, <code>lastDigit(3572)</code> should return <code>2</code>. It should work for negative numbers as well. For example, <code>lastDigit(-947)</code> should return <code>7</code>.</p>
  </blockquote>
  
  <p>Where this problem gets tricky for me is that I am not allowed to use a <code>String</code> to solve this problem. Here's what I have thus far-</p>
  
  <pre><code>public static int lastDigit(int d) {  // d is the integer they call
      // i know that whatever goes here will be something like this
      int b = charAt(length - 1);
      return b;
  }
  </code></pre>
  
  <p>Any tips? Thanks!</p>