Quote (axumo0 @ Nov 3 2014 04:10pm)
Quick Question;
If I have a string of numbers for example:
18.0 8 307.0 130.0 3504. 12.0 70 1
How would i convert each of these numbers to a double and put each one into a separate double array?
In Java:
Scanner data = new Scanner(pathToFile);
String numbers = data.nextLine();
//The entire string is now in the string numbers
String[] splitNums = numbers.split(" ");
double[] nums;
for(int i=0; i<splitNums.length; i++)
{
//Parse each element of splitNums into double array
nums[i] = Double.parseDouble(splitNums[i]);
}