Okay after hours of scouring google and stackoverflow I kind of have a solution. It doesn't look very pretty and it feels like I put it together using duck tape but here is what I got. I'm studying for my Security+ certification right now so that's where I got the C^N formula from.
package sandbox;
import javax.swing.JOptionPane;
import java.util.regex.*;
class Strength {
public static void main(String[] args){
String password =JOptionPane.showInputDialog("Enter your password here:");
//parse password to turn set c and n value;
int c = 0;
//let's figure things out
int uppercase = 0, lowercase = 0, numbers = 0, specChars = 0;
for (int i=0; i<password.length(); i++){
if(Character.isUpperCase(password.charAt(i))) uppercase++;
else if (Character.isLowerCase(password.charAt(i))) lowercase++;
}
Pattern p = Pattern.compile("^a-zA-Z0-9");
Matcher m = p.matcher(password);
boolean b = m.matches();
if (b == false){
specChars = specChars +1;
}
if(password.matches(".*[0-9]*.")){
numbers++;
}
//Let's add!
if(uppercase> 0){
c = c + 26;
}
if(lowercase> 0){
c = c + 26;
}
if(numbers>0){
c = c + 10;
}
if(specChars>0){
c = c + 10;
}
int n = password.length();
double pStrength = Math.pow(c,n);
System.out.println("C ="+ c);
System.out.println("N ="+ n);
System.out.println("C^N ="+ pStrength);
if (pStrength >= Math.pow(72,12)){
System.out.println("Your password is strong enough to store DoD files.");
}
else if (pStrength <= Math.pow(72,12)){
System.out.println("Your password is NOT strong enough to store DoD files.");
}
}
}