static boolean isTriangular ( int num ) {
  if ( num < 0 ) return false ;
  int c = ( - 2 * num ) ;
  int b = 1 , a = 1 ;
  int d = ( b * b ) - ( 4 * a * c ) ;
  if ( d < 0 ) return false ;
  float root1 = ( - b + ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ;
  float root2 = ( - b - ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ;
  if ( root1 > 0 && Math . floor ( root1 ) == root1 ) return true ;
  if ( root2 > 0 && Math . floor ( root2 ) == root2 ) return true ;
  return false ;
}

static boolean isTriangular ( int num ) { if ( num < 0 ) return false ; int c = ( - 2 * num ) ; int b = 1 , a = 1 ; int d = ( b * b ) - ( 4 * a * c ) ; if ( d < 0 ) return false ; float root1 = ( - b + ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ; float root2 = ( - b - ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ; if ( root1 > 0 && Math . floor ( root1 ) == root1 ) return true ; if ( root2 > 0 && Math . floor ( root2 ) == root2 ) return true ; return false ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (false))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (parenthesized_expression (binary_expression left: (unary_expression operand: (decimal_integer_literal)) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (false))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (unary_expression operand: (identifier)) right: (cast_expression type: (floating_point_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (unary_expression operand: (identifier)) right: (cast_expression type: (floating_point_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)))) consequence: (return_statement (true))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)))) consequence: (return_statement (true))) (return_statement (false))))