Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int getCapsSize(String str)
- {
- double counter = 0.0D;
- double total = str.length();
- for (char c : str.toCharArray()) {
- if (Character.isUpperCase(c)) {
- counter += 1.0D;
- } else if (c == ' ') {
- total -= 1.0D;
- }
- }
- return (int)Math.round(counter / total * 100.0D);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement