static void findMinNum ( int arr [ ] , int n ) {
  int first = 0 , last = 0 , num , rev , i ;
  int hash [ ] = new int [ 10 ] ;
  for ( i = 0 ;
  i < n ;
  i ++ ) {
    hash [ arr [ i ] ] ++ ;
  }
  System . out . print ( "Minimum number: " ) ;
  for ( i = 0 ;
  i <= 9 ;
  i ++ ) {
    for ( int j = 0 ;
    j < hash [ i ] ;
    j ++ ) System . out . print ( i ) ;
  }
  System . out . println ( ) ;
  System . out . println ( ) ;
  for ( i = 0 ;
  i <= 9 ;
  i ++ ) {
    if ( hash [ i ] != 0 ) {
      first = i ;
      break ;
    }
  }
  for ( i = 9 ;
  i >= 0 ;
  i -- ) {
    if ( hash [ i ] != 0 ) {
      last = i ;
      break ;
    }
  }
  num = first * 10 + last ;
  rev = last * 10 + first ;
  System . out . print ( "Prime combinations: " ) ;
  if ( isPrime ( num ) && isPrime ( rev ) ) {
    System . out . println ( num + " " + rev ) ;
  }
  else if ( isPrime ( num ) ) {
    System . out . println ( num ) ;
  }
  else if ( isPrime ( rev ) ) {
    System . out . println ( rev ) ;
  }
  else {
    System . out . println ( "No combinations exist" ) ;
  }
}

static void findMinNum ( int arr [ ] , int n ) { int first = 0 , last = 0 , num , rev , i ; int hash [ ] = new int [ 10 ] ; for ( i = 0 ; i < n ; i ++ ) { hash [ arr [ i ] ] ++ ; } System . out . print ( " Minimum ▁ number : ▁ " ) ; for ( i = 0 ; i <= 9 ; i ++ ) { for ( int j = 0 ; j < hash [ i ] ; j ++ ) System . out . print ( i ) ; } System . out . println ( ) ; System . out . println ( ) ; for ( i = 0 ; i <= 9 ; i ++ ) { if ( hash [ i ] != 0 ) { first = i ; break ; } } for ( i = 9 ; i >= 0 ; i -- ) { if ( hash [ i ] != 0 ) { last = i ; break ; } } num = first * 10 + last ; rev = last * 10 + first ; System . out . print ( " Prime ▁ combinations : ▁ " ) ; if ( isPrime ( num ) && isPrime ( rev ) ) { System . out . println ( num + " ▁ " + rev ) ; } else if ( isPrime ( num ) ) { System . out . println ( num ) ; } else if ( isPrime ( rev ) ) { System . out . println ( rev ) ; } else { System . out . println ( " No ▁ combinations ▁ exist " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) 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: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (update_expression (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))))