Let's say I have a file called "input.txt" that has a bunch of positive integers in it:
6 5 6 8 6 2 4
etc .... (one integer per line)
I want to read this file and make it into an array. The first integer (in this case 6) indicates the number of indices or elements in the array, therefore 6 points. The remaining numbers fill the array starting at 0. Thus, at index 0, the number is 5, at index 1 - 6, etc.
Can someone please show me how to read this file and make it into an array named A and return the integers in each index as n?
this is what i have so far:
import java.io.*; public class inputFile { public static jobScheduleRecursive(int[] A, int i) { try { FileReader filereader = new FileReader("input.txt"); BufferedReader bufferedreader = new BufferedReader(filereader); String line = bufferedreader.readLine();
I think I'm doing something completely wrong. please, help.
user986024
source share