Skip to content

Instantly share code, notes, and snippets.

@Dyndrilliac
Last active March 22, 2017 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dyndrilliac/487fc06ddc47ab55968180358c60691b to your computer and use it in GitHub Desktop.
Save Dyndrilliac/487fc06ddc47ab55968180358c60691b to your computer and use it in GitHub Desktop.
PrimeTest
import api.util.Mathematics;
public class PrimeTest
{
public static void main(String[] args)
{
int n = -4;
StdOut.println(Mathematics.isEven(n)); // true
StdOut.println(Mathematics.isPrime(n)); // false
StdOut.println(Mathematics.makePrimeGreater(1)); // 2
StdOut.println(Mathematics.makePrimeGreater(n) + "\n"); // 2
//StdOut.println(Long.MAX_VALUE); // 9223372036854775807
//StdOut.println(Mathematics.makePrimeLesser(Long.MAX_VALUE)); // 9223372036854775783
//StdOut.println(Mathematics.makePrimeLesser(n)); // Throws IllegalArgumentException
//StdOut.println(Mathematics.makePrimeGreater(Long.MAX_VALUE)); // Throws IllegalArgumentException
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment