Java, konsoldan okuma ve parsing (Parse) nasıl yapabilirim ?

public class MyClass {
public static void main(String args[]) {
int[] firstArray = {2};
int[] secondArray = {15};
if (firstArray.length < secondArray.length){
int[] tmp = firstArray;
firstArray = secondArray;
secondArray = tmp;
}
int maxSallary = 17;
int sallary = 0;
int maxResume = getMaxResume(secondArray, 0, 0, maxSallary);

for (int i = 0; i < firstArray.length; i++){
if(sallary + firstArray[i] > maxSallary){
break;
}
sallary += firstArray[i];
int resume = getMaxResume(secondArray, i + 1, sallary, maxSallary);
if (resume > maxResume){
maxResume = resume;
}
}
System.out.println(maxResume);
}

public static int getMaxResume(int[] array, int resume, int sallary, int maxSallary){
for (int j = 0; j < array.length; j++){
if (sallary + array[j] > maxSallary){
break;
}
sallary += array[j];
resume++;
}
return resume;
}
}​