String sNumbers = JOptionPane.showInputDialog("Enter in the amount of possible numbers: \n"); int iNumbers = Integer.parseInt(sNumbers); String sBalls = JOptionPane.showInputDialog("Enter in the amount of balls taken: \n"); int iBalls = Integer.parseInt(sBalls); int iFactorial = 1; int iCount = 0; int iTotal = iNumbers; for(iCount = (iNumbers - 1); iCount > (iNumbers - iBalls); iCount--){ iTotal *= iCount; }