I retrieved individual String values from a database and converted it into a String array by using the String method split().
ResultSet set = state.executeQuery("SELECT * FROM numberLotto");
while(set.next())
{
num1 = set.getString(1);
num2 = set.getString(2);
num3 = set.getString(3);
num4 = set.getString(4);
num5 = set.getString(5);
num6 = set.getString(6);
num7 = set.getString(7);
totalLotto += num1 + " " + num2 + " " + num3 + " " + num4 + " " +
num5 + " " + num6 + " " + num7 + " " + "/";
}
String[]listOfNumbers = totalLotto.split("/");
The resulting output is as follow
3 18 27 38 41 45 47
4 7 11 15 22 33 42
2 9 15 23 24 39 44
4 11 16 17 35 39 48
etc
How could I add the above numbers into an array of an array so that I can loop through each individual number?(and subsequently check if they are contained in a list of winning numbers?)
Kind regards
Why are you using strings at all? This seems to be numbers so integers would be a better match:
You obviously could also use
Integer[]if necessary.