Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. private int getCapsSize(String str)
  2. {
  3. double counter = 0.0D;
  4. double total = str.length();
  5. for (char c : str.toCharArray()) {
  6. if (Character.isUpperCase(c)) {
  7. counter += 1.0D;
  8. } else if (c == ' ') {
  9. total -= 1.0D;
  10. }
  11. }
  12. return (int)Math.round(counter / total * 100.0D);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement