public static void prime ( long n ) {
  int flag = 0 ;
  if ( ( n + 1 ) % 6 != 0 && ( n - 1 ) % 6 != 0 ) {
    System . out . println ( "Not Prime" ) ;
  }
  else {
    double s = sqrt ( n ) ;
    if ( ( s * s ) == n ) {
      System . out . println ( "Semi-Prime" ) ;
    }
    else {
      long f = ( long ) s ;
      long l = ( long ) ( ( f * f ) ) ;
      for ( long i = f + 1 ;
      i < l ;
      i ++ ) {
        long p = i - ( long ) ( sqrt ( ( i * i ) - ( n ) ) ) ;
        long q = n / p ;
        if ( p < 2 || q < 2 ) {
          break ;
        }
        if ( ( p * q ) == n ) {
          flag = 1 ;
          break ;
        }
        else {
          flag = 2 ;
        }
      }
      if ( flag == 1 ) {
        System . out . println ( "Semi-Prime" ) ;
      }
      else if ( flag == 2 ) {
        System . out . println ( "Prime" ) ;
      }
    }
  }
}

public static void prime ( long n ) { int flag = 0 ; if ( ( n + 1 ) % 6 != 0 && ( n - 1 ) % 6 != 0 ) { System . out . println ( " Not ▁ Prime " ) ; } else { double s = sqrt ( n ) ; if ( ( s * s ) == n ) { System . out . println ( " Semi - Prime " ) ; } else { long f = ( long ) s ; long l = ( long ) ( ( f * f ) ) ; for ( long i = f + 1 ; i < l ; i ++ ) { long p = i - ( long ) ( sqrt ( ( i * i ) - ( n ) ) ) ; long q = n / p ; if ( p < 2 || q < 2 ) { break ; } if ( ( p * q ) == n ) { flag = 1 ; break ; } else { flag = 2 ; } } if ( flag == 1 ) { System . out . println ( " Semi - Prime " ) ; } else if ( flag == 2 ) { System . out . println ( " Prime " ) ; } } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (parenthesized_expression (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (identifier)))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (break_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))))))