View Single Post
Old 11-10-2012, 04:43 PM   PM User | #3
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,449 Times in 2,418 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
This is a bit unusual; you are working off of input for the application command, but you do not appear to use any additional methods or object types. Casting and parsing isn't IMO something that should be learned before method handling.
The trick here is to simply ensure you have a double[] or Double[] to work with.
PHP Code:
        double[] dValues = new double[args.length];
        for (
int i 0args.length; ++i)
        {
            
dValues[i] = Double.parseDouble(args[i]);
        } 
Simple as that. You now work with only dValues to collect the information about the count, max/min (easy via sorting a copy), average, sum, whatever you want.

Also, in the future please use [php][/php] or [code][/code] tags as it preserves the formatting.
Fou-Lu is offline   Reply With Quote