Skip to content

Instantly share code, notes, and snippets.

@Dyndrilliac

Dyndrilliac/PrimeTest.java

Last active Mar 22, 2017
Embed
What would you like to do?
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