Using Standard JDK

public static boolean isUpperCase(String s) {
    for (int i = 0; i < s.length(); i++) {
        if (Character.isLowerCase(s.charAt(i)))
            return false;
    }

    return true;
}

NOTE: There are also alternatives using Apache Commons or Guava libraries, but they may run into issues when the string contains punctuations/other symbols.

Reference



Published

06 November 2016

Tags


Table of Contents