package main;
public class Practice {
    public static void main(String[] args) {
        int array[] = {19, 3, 15, 7, 11, 9, 13, 5, 17, 1};
        
        int base10=0;
        for (int j=1; j <=100; j+=10) {
            System.out.print(j + " - " + (base10+=10) + "  | " );
            for (int index = j ; index <= base10 ; index ++) {
                while(array[index] > 0) {
                    System.out.print("*");
                    array[index]--;
                }
            }
            System.out.println();
        }
    }
}
I want to display, one asterisk(*) for each value within the range between 1 to 10, 11 to 20, and so on. Here is my code but I am getting error! This is the output:
1 - 10  | *******************************************************************
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 10
    at main.Practice.main(Practice.java:25)
 
     
    