Here you can find the source of length(String[] arr)
public static int length(String[] arr)
//package com.java2s; //License from project: Apache License public class Main { public static int length(byte[] bytes) { if (bytes == null) return 0; return bytes.length; }//from w w w . jav a 2 s .c o m public static int length(byte[][] bytes) { if (bytes == null) return 0; int count = 0; for (int i = 0; i < bytes.length; i++) { if (bytes[i] != null) count += bytes[i].length; } return count; } public static int length(String str) { if (str == null) return 0; return str.length(); } public static int length(String[] arr) { if (arr == null || arr.length == 0) return 0; int sum = 0; for (String s : arr) sum += length(s); return sum; } }