i can't get it to loop the number of tickets that the user puts in. and right now i keep on getting an ArrayoutofBoundException:0 in my main. i can't see what's wrong with it
import java.io.*; import java.util.*; public class Lotto { //*********commandLine1()********** public static boolean commandLine1(String str) { if(!str.equalsIgnoreCase("mm") && !str.equalsIgnoreCase("sl")) return(false); else return(true); } //*********commandLine2()********** public static boolean commandLine2(String str) { int i = 0; while(i < str.length()) { char c = str.charAt(i); if(c < '0' || c > '9') return(false); i++; } return(true); } //**********random()*************** public static int random(int a, int b) { return((int)((b - a + 1)*Math.random() + a)); } //**********superLottoNumbers()********* public static int[] superLottoNumbers() { System.out.println(" Super Lotto "); System.out.println(" Mega"); int numZ[] = new int[6]; for(int h = 0; h <=4; h++) { numZ[h] = random(1,47); } numZ[6] = 99; Arrays.sort(numZ); numZ[6] = random(1,27); return(numZ); } //**********megaMillionNumbers()********* public static int[] megaMillionNumbers() { System.out.println(" Mega Million Lotto "); System.out.println(" Mega"); int numZ[] = new int[6]; for(int i = 0; i <= 4; i++) { numZ[i] = random(1,56); } numZ[5] = 99; Arrays.sort(numZ); numZ[5] = random(1,46); return(numZ); } public static void main(String args[]) { if(commandLine1(args[0]) == false) System.err.println("Not a valid type of Lottery");System.exit(1); if(commandLine2(args[1]) == false) System.err.println("Not a valid number of tickets");System.exit(2); if(args[1].equals("0")) System.err.println("Can't print out 0 ticekts.");System.exit(3); if(args[0].equalsIgnoreCase("sl")) { int num[] = new int[7]; for(int k = 0; k <Integer.parseInt(args[1]) ; k++) { for(int h = 0; h < 6 ; h++) { num = superLottoNumbers(); System.out.print(num[h]+" "); } } } /* if(args[0].equalsIgnoreCase("mm")) { int num[]; for(int k = 0; k <Integer.parseInt(args[1]); k++) { num = megaMillionNumbers(); for(int i: num) System.out.print(i+" "); } }*/ } }