public static boolean isPrime(long value){
        if(2==value){//the first factor is 2
            return true;
        }
        if(3==value){//the second factor is 3
            return true;
        }
        if(value%2==0){
            return false;
        }
        if(value%6!=1&&value%6!=5){
            return false;
        }
        for(long smallerFactor = 3;
                smallerFactor*smallerFactor<=value;
                smallerFactor+=2){

            if(value%smallerFactor==0){

                return false;
            }
        }
        return true;
    }