Here you can find the source of lengthOfShortestIn(String[] strings)
Parameter | Description |
---|---|
strings | String[] |
public static int lengthOfShortestIn(String[] strings)
//package com.java2s; /**/*from w w w . j a v a2 s . c om*/ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ public class Main { /** * Return the length of the shortest string in the array. * If any one of them is null then it returns 0. * * @param strings String[] * @return int */ public static int lengthOfShortestIn(String[] strings) { int minLength = Integer.MAX_VALUE; for (int i = 0; i < strings.length; i++) { if (strings[i] == null) return 0; minLength = Math.min(minLength, strings[i].length()); } return minLength; } }