Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float testSameUser(String user1, String user2) {
- if(user1.length() != user2.length()) {
- System.out.println("[ERROR] Uservalues don't have the same length!");
- return 0F;
- }
- int sameAnswers = 0;
- char[] user1char = user1.toCharArray();
- char[] user2char = user2.toCharArray();
- for(int i=0; i<user1.length(); i++) {
- if(user1char[i] == user2char[i]) {
- sameAnswers++;
- }
- }
- return sameAnswers/user1.length();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement