title: I want to take out Last Digit of Huge Number Stored in BigInteger In JAVA
body: <pre><code>import java.math.BigInteger;
  import java.util.Scanner;
  
  public class LastFact
  {
      // Returns Factorial of N
      static BigInteger factorial(int N)
      {
          // Initialize result
          BigInteger f = new BigInteger("1"); // Or BigInteger.ONE
  
          // Multiply f with 2, 3, ...N
          for (int i = 2; i &lt;= N; i++)
              f = f.multiply(BigInteger.valueOf(i));
  
          return f;
      }
  
      // Driver method
      public static void main(String args[]) throws Exception
      {
          int N = 300;
  
          System.out.println(factorial(N));
      }
  }
  </code></pre>