I am working on a java project and I have a loop that is driving me crazy.
The program takes an input, N, which is a positive integer. What I want my loop to do is this:
Lets say that N = 10. The loop will take all numbers from 1 to 10, raise it to the fifth power, and store each value in an array of length N.
It works (seemingly) correctly up until N = 73, I think. Once N hits 74 or above it starts to randomly give me negative numbers for 74^5. Which obviously is incorrect. The higher the number, the more negatives it gives me.
private static int _theLimit = EquationSolver.getLimit(); //input "N"
private static int length = (int) (_theLimit); //length of possible solutions array = N
static int[] _solutions = new int[length]; 
public static void solutionRun() {
    for(int i = 1; i <=_theLimit ;) { 
        //theLimit refers to the input N; for numbers from 1 until N
        for (int p = 0; p <= _solutions.length-1; p++) { 
            //solutions is an array that stores all possible solutions to ^5 from 1 to N; 
            _solutions[p] = i*i*i*i*i; 
            //p refers to the array location, increments with each new i
            i++;
        }           
    }
    for(int q = 0; q<=_solutions.length-1; q++){ //outputs solutions for debugging purposes
        System.out.println(_solutions[q]);
    }
}
 
     
     
    