Need help with error
Hi, I am writing a program and I cannot quite figure out this one error:
"cannot invoke longValue() on the primitive type double"
Here is the snippet of code the error occurs on, any ideas of what I can do?
Thanks in advance. (the error occurs on the line:
if (new FactorFinder(N.longValue()).getFactor
(Long.parseLong(retVal)) == 1)
Here is my code:
try{
ConsecutiveDigitReader cdr = new ConsecutiveDigitReader(8,fr);
String retVal = "";
while (true) {
retVal = cdr.nextConsecutiveDigits();
//System.out.println("got Value " + retVal);
if (!retVal.equals("null")) {
double N = Math.sqrt(Double.parseDouble(retVal));
N = Math.ceil(N);
//System.out.println("maxVal " + N.longValue());
if (new FactorFinder(N.longValue()).getFactor(Long
.parseLong(retVal)) == 1) {
System.out.println("Found Prime " + retVal);
break;
}
} else {
System.out.println("Could not find a prime");
break;
}
//new FactorFinder(Long.parseLong(retVal)).getFactor(Long.parseLong(retVal));
}
} catch (IOException io) {
io.printStackTrace();
}

