Skip to content

Instantly share code, notes, and snippets.

@BatteryAcid
Created July 31, 2020 04:07
Show Gist options
  • Save BatteryAcid/d82dbf647cdafad7b00b1750cfff2750 to your computer and use it in GitHub Desktop.
Save BatteryAcid/d82dbf647cdafad7b00b1750cfff2750 to your computer and use it in GitHub Desktop.
Test
// javac Test.java
// java Test
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Test {
public static void main(String args[]) {
int[] val = lineReader(new String[] {"0000/", "1111/", "22222/", "3333/","44444/","55555/","6666/"});
for (int x = 0; x<val.length;x++) {
System.out.println(val[x]);
}
}
public static int[] lineReader(String[] array1){
int[] storedNumsArray = new int[7];
for(int x=0; x<array1.length; x=x+1){
Scanner fileSc = new Scanner(array1[x]);
fileSc.useDelimiter("/");
storedNumsArray[x] = Integer.parseInt(fileSc.next());
fileSc.useDelimiter("\n");
fileSc.next();
}
return storedNumsArray;
}
}
/**
output
0
1111
22222
3333
44444
55555
6666
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment