Stick solutions of a loop into an array
I am trying to write a program which will create a loan amoritization table. The loan table will basically be such that there is a loan balance, an interest paid per month and a principle paid per month. These values change with every iteration of the loop. I'm looking for a loop, or a way to add these values into an array, as well as continue with the values so the loop continues to operate. Below is the loop I'm using for creating the loan amoritization table. Eventually I want to take these values from the array and use them to create a graph. The initial loan variables are not fixed, they are relative to user input, so I don't know how big each array will be given the user input. Here's is the current loop I'm using.
Thanks for the help!
while (loanBalance > 0) //Loop condition
MortgageBalance balance = new MortgageBalance((customInterest), interest1, principle1, payment1, loanBalance); //creates new instance of loan balance class which contains methods for calculating balance, principle and interest paid
//begin output and then calculate new variables
outputJTextArea.append(loancounter + " " + df.format(payment1) + " " + df.format(interest1) + " " + df.format(principle1) + " " + df.format(loanBalance) + newline); //Outputs loan amoritization table to JTextArea
interest1 = balance.interest(); //method to calculate interest paid
principle1 = balance.principle(); //method to determine principle paid
loanBalance= balance.loanBalance();//method to determine remaining loan balance