/guava/guava/src/com/google/common/base/Strings.java
int maxPrefixLength = Math.min ( a.length ( ) , b.length ( ) ) ;
System.arraycopy(array, 0, array, n, size - n); return new String(array); } public static String commonPrefix(CharSequence a, CharSequence b) { checkNotNull(a); checkNotNull(b); <extra_id_0> int p = 0; while (p < maxPrefixLength && a.charAt(p) == b.charAt(p)) { p++; } if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1)) { p--;