I have created a method that checks if an Input is between the size of column in a csv File.
public static boolean isValidNumber(String uInput) {
Long convert = Long.parselong (uInput);
int convert2 = (int) convert;// Need to do this because of the JOptionPane
if(colmn.length > convert) {
System.out.println("The Column exists.");
}
else { System.out.println("The Column doesn't exists.");}
return true; }}
And in the main method i refer to the isValidNumber-Method
// some previous code
do { String userInput = JOptionPane.showInputDialog);
} while(isValidNumber(userInput));}
//next code
So i can't get out of the Loop even if the userInput is correct and exists in the csv-file. Can someone help me out?