Created
July 31, 2020 04:07
-
-
Save BatteryAcid/d82dbf647cdafad7b00b1750cfff2750 to your computer and use it in GitHub Desktop.
Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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