title: why nano seconds have to use int instead of long in java
body: <p>I have been doing this exercise and this is the code</p>
  <pre><code>import java.time.*;
  import java.util.*;
  public class Exercise31 {  
      public static void main(String[] args){
          LocalDateTime dateTime = LocalDateTime.of(2016, 9, 16, 0, 0);
          LocalDateTime dateTime2 = LocalDateTime.now();
          int diffInNano = java.time.Duration.between(dateTime, dateTime2).getNano();
          long diffInSeconds = java.time.Duration.between(dateTime, dateTime2).getSeconds();
          long diffInMilli = java.time.Duration.between(dateTime, dateTime2).toMillis();
          long diffInMinutes = java.time.Duration.between(dateTime, dateTime2).toMinutes();
          long diffInHours = java.time.Duration.between(dateTime, dateTime2).toHours();
          System.out.printf(&quot;\nDifference is %d Hours, %d Minutes, %d Milli, %d Seconds and %d Nano\n\n&quot;,
                  diffInHours, diffInMinutes, diffInMilli, diffInSeconds, diffInNano );
      }
  }
  </code></pre>
  <p>Doesnt nanoseconds have to use long instead of int because the nanoseconds in the range?</p>