im new to java and i have trouble with array not sure if i need to make a new static class i believe i do but my code works exactly as i want it to but im missing 2 things a counter counting the number of times my "numholder" variable comes up and as which number ie: 2 came up 3 times till the user hits quit
not sure if i should put it in an array or write in a counter because it has to count both the straight line and if the user chooses to "bet" on another number without spinning i put in the option alrdy under my "additional" variable but i think thats were i need my array not sure if theres another way to do it would appreciate some help
if (bet == 'a'|| bet == 's') { if (bet == 'a') { System.out.println("If you bet a number leave a space between each number"); s=scan2.toString(); String arrayString[] = s.split("\\s+"); String[] items = s.split("\\s+"); int[] results = new int[items.length]; for (int i = 0; i < items.length; i++) { try { results[i] = Integer.parseInt(items[i]); } catch (NumberFormatException nfe) {}; amountholder= howmuch* arrayString.length; } if (amountholder>iamount) { System.out.println("You bet to much"); } else { int numholder1 = rand.nextInt(odds) + 1; int[] array = results; int value =numholder; int index = Arrays.asList(array,betnum).indexOf(numholder); System.out.println("You got" + numholder1); if(index>0); { wins++; newcash=iamount +(howmuch* (odds-1)); System.out.println("Congratz you Won" + " "+ (howmuch* (odds-1))); } if(index<0) { newcash= (iamount-howmuch); lose++; System.out.println("Sorry you lost" +" " + howmuch); } } System.out.println("You now have "+ newcash + "$"); System.out.println("Type: b to bet"); System.out.println("Type q to quit"); userinput = scan1.nextLine().charAt(0);