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();

}

[1207 byte] By [kumar103a] at [2007-11-27 4:14:09]
# 1
You can't invoke methods on primitives. What part about that is confusing?
CaptainMorgan08a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 2
What can I do to fix this?
kumar103a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 3
Maybe you want to cast it to a long?(long)N
CaptainMorgan08a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 4
I actually tried:if (new FactorFinder((long)N.longValue()).getFactor ...but it didnt work.I also tried casting it above that too like this:(long) N = Math.ceil(N); ... doesn't work either.Please help!
kumar103a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 5
long is still a primitive. Try this:if (new FactorFinder((long)N).getFactor...
CaptainMorgan08a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 6
thanks for your replies... so should I completely get rid of the bold part below:if (new FactorFinder((long)N).longValue()).getFactor... so it reads:if (new FactorFinder((long)N)).getFactor ... because that doesn't work.I'm soo confused.
kumar103a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...
# 7
sorry that second snippet of code I wrote does work... will this be correct though without the longValue? Is it the same thing?Thanks again.
kumar103a at 2007-7-12 9:20:29 > top of Java-index,Java Essentials,Java Programming...