Ask an user to type in a password, a qualified password should follow the constraints, such as:
Length of password >= 8
Include at least one uppercase character
Include at least one lowercase character
Include at least one integer
Include at least special character
Write a program to check if the user gives a qualified password.

The program for a user to create a password as the above details specify. I dont think should be using so many while loops, when i run and enter the characters im not getting the quilified password, help plz.

import javax.swing.JOptionPane;
public class PassWord
{
public static void main (String[] args)
{
String input;
input = JOptionPane.showInputDialog("Enter " +
"a password in the form Ln1@shl2\n");
if (isValid(input))
{
JOptionPane.showMessageDialog(null,
"That's a qualified password.");
}
else
{
JOptionPane.showMessageDialog(null,
"That is not the proper format of a " +
"password, it should include at least one uppercase & lowercase letter, one number & a special charater .\nHere is an " +
"example: Ab$dj234");
}
System.exit(0);
}
private static boolean isValid(String passUser)
{
boolean goodSoFar = true;
int i = 0;
if (passUser.length() != 8)
goodSoFar = false;
while (goodSoFar && i < 1)
{
if (!Character.isLetter(passUser.charAt(i))…
goodSoFar = false;
i++;
}
while (goodSoFar && i < 2)
{
if (!Character.isDigit(passUser.charAt(i)))
goodSoFar = false;
i++;
}
while (goodSoFar && i < 3)
{
if (!Character.isUpperCase(passUser.charAt(…
goodSoFar = false;
i++;
}
while (goodSoFar && i < 4)
{
if (!Character.isLowerCase(passUser.charAt(…
goodSoFar = false;
i++;
}
while (goodSoFar && i < 5)
{
if (!Character.isSpaceChar(passUser.charAt(…
goodSoFar = false;
i++;
}
while (goodSoFar && i < 8)
{
if (!Character.isLetter(passUser.charAt(i))…
goodSoFar = false;
i++;
}
return goodSoFar;
}
}