public static double [] loadGravityData( ) throws IOException
{
File fileName = new File("gravity1.txt");
Scanner inFile = new Scanner(fileName);
double [] gravityData = {};
while(inFile.hasNext())
{
for(int i = 0; i <= gravityData.length; i++)
{
gravityData[i] = inFile.nextDouble();
}
}
inFile.close();
return gravityData;
}
The gravityData of i part is what is returning the exception. Any help would be much appreciated.