Im trying to obtain a series of numbers from a for loop using JOptionPane. The for loop works fine i run into trouble with the array. How do i get it print the numbers in a JTextField? My code is the following:
int value = Integer.parseInt(JOptionPane.showInputDialog("Please enter the amount of numbers you want to input"));
int[] holy = new int[value];
StringBuilder water = new StringBuilder();
for(int i = 1; i<=value; i++){
int num = Integer.parseInt(JOptionPane.showInputDialog("Enter a number"));
holy[i]= num;
}
for(int j = 0; j<holy.length; j++){
water.append(holy[j]);
tfholy.setText(water.toString());
}