Java examples for java.lang:int prime
Finds out if number is a prime-number
//package com.java2s; public class Main { /**// w w w . j a v a 2s.c o m * Finds out if <b>number</b> is a prime-number * @param number * @return TRUE if prime */ public static boolean isPrime(long number) { boolean result = true; for (long current = number / 2; current > 1; current--) { if ((number / current) * current == number) { result = false; break; } } return result; } }