A locker room has lockers numbered 0,1,2,...,1023 . All lockers are initially closed. The first person walks in and flips every locker The 2nd person flips every other locker (starting at 0) The 3rd person flips every third locker (starting at 0) . . . The 1024 person flips every 1024 locker (starting at 0) At the end, which lockers are open and which are closed?

What the program must do:

Write a program that creates an array of 1024 indices of type Boolean. Each index will represent a locker. You may assume that when the Boolean value is false, the locker is closed and when the value is true, the locker is open. This program will determine which lockers are open and closed at the end of the procedure above.

So it will output the locker number and whether or not it is open or closed.

For starters I was thinking to create an array calledwhich will create 1024 indices with either true or false (open or closed) elements.boolean[] Lockers = new boolean[1024];

What I don't know is how to make every person go to their correct interval locker, and put it into a loop. When helping please don't use advanced code I have only learned arrays, while/dowhile/for loops,bubble sort*, user input.

I'm a complete newb at Java so any help would be appreciated.

*I also think bubble sort should be applied here, but I don't know how to apply it.

The following code is an unfinished bubble sorting program that I don't understand how to complete.

For the code above, the for-loop will move through the array x and swap any values if the current index is greater than the next index. To complete the bubble sort, the for loop above needs to be repeated until no swaps are made. Using the code above, add a Boolean variable called swap and a conditional loop that will repeat the for-loop until no more swaps are made.int []x = {4, 2, 3,5,1}; int temp; for (int c=0; c<x.length-1; c++){ if (x[c]>x[c+1]){ temp = x[c+1]; x[c+1]=x[c]; x[c] = temp; } }