Check out example codes for "find shortest string in array java". It will help you in understanding the concepts better.

Code Example 1

public static String smallest(String words[]) {
    if (words == null || words.length < 1) {
        return "";
    }
    String smallest = words[0];
    for (int i = 1; i < words.length; i++) {
        if (words[i].length() < smallest.length()) {
            smallest = words[i];
        }
    }
    return smallest;
}// smallest

Learn ReactJs, React Native from akashmittal.com