title: Basic Java: Method to tell if a double is an integer
body: <p>I'm a beginning programmer and I need a method that returns whether or not a double is an integer. The problem occurs when the number is too big for an int to hold.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>private static boolean isInteger(double n){
      int ni = (int) n;
      double nd = (double) ni;
      if (nd==n)
          return true;
      return false;
  }
  </code></pre>
  
  <p>Say I put in like 143215890634.0. It will return false because the int can't store that many digits.</p>
  
  <p>How can I allow the int(or another class) to store more digits or is there a better way to determine if a double is an int without comparing like this?</p>
  
  <p>Thanks in advance!</p>