static String commonPrefix ( String arr [ ] , int n ) {
  int minlen = findMinLength ( arr , n ) ;
  String result = "" ;
  char current ;
  for ( int i = 0 ;
  i < minlen ;
  i ++ ) {
    current = arr [ 0 ] . charAt ( i ) ;
    for ( int j = 1 ;
    j < n ;
    j ++ ) {
      if ( arr [ j ] . charAt ( i ) != current ) {
        return result ;
      }
    }
    result += ( current ) ;
  }
  return ( result ) ;
}

static String commonPrefix ( String arr [ ] , int n ) { int minlen = findMinLength ( arr , n ) ; String result = " " ; char current ; for ( int i = 0 ; i < minlen ; i ++ ) { current = arr [ 0 ] . charAt ( i ) ; for ( int j = 1 ; j < n ; j ++ ) { if ( arr [ j ] . charAt ( i ) != current ) { return result ; } } result += ( current ) ; } return ( result ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (array_access array: (identifier) index: (decimal_integer_literal)) name: (identifier) arguments: (argument_list (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (identifier))) right: (identifier))) consequence: (block (return_statement (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (parenthesized_expression (identifier)))))) (return_statement (parenthesized_expression (identifier)))))