- Jun 29, 2002
- 922
- 0
- 76
Originally posted by: CrackaLackaZe
damnit...part of the assignment was to write a code with a method set to recieve a float array from a double array from main. And I can't use for loops...it has to all be done recursively. I have all of it written but can't get around this problem.
I guess I could do what you suggested recursively, but are there any more elegant ways around this?
Originally posted by: amdfanboy
Originally posted by: CrackaLackaZe
damnit...part of the assignment was to write a code with a method set to recieve a float array from a double array from main. And I can't use for loops...it has to all be done recursively. I have all of it written but can't get around this problem.
I guess I could do what you suggested recursively, but are there any more elegant ways around this?
How about a while loop?
<-smartass
Originally posted by: beyonddc
To get this right, first, you shouldn't use casting.
Take a look at the Java API for - double
http://java.sun.com/j2se/1.4.2...uble.html#floatValue()
You should be using Double.floatValue() to let a Double variable to return you back with a float object.
Originally posted by: Kilrsat
Originally posted by: amdfanboy
Originally posted by: CrackaLackaZe
damnit...part of the assignment was to write a code with a method set to recieve a float array from a double array from main. And I can't use for loops...it has to all be done recursively. I have all of it written but can't get around this problem.
I guess I could do what you suggested recursively, but are there any more elegant ways around this?
How about a while loop?
<-smartass
He wanted to convert a double[] to a float[], not a float[] to a double[]
<-- smarterass