private static int prefixLen ( String o1 , String o2 ) { final int l1 = o1 . length ( ) , l2 = o2 . length ( ) , l = l1 < l2 ? l1 : l2 ; int prefix = 0 ; while ( prefix < l && ( o1 . charAt ( prefix ) == o2 . charAt ( prefix ) ) ) { prefix ++ ; } return prefix ; }
Compute the length of the prefix .