I hope you meant something like this:
int amountNums = Integer.parseInt(JOptionPane.showInputDialog("Enter a number of numbers to use in your calculation "));

// Keep reading data until...