public static boolean bellmanFord ( ) {
  for ( int i = 0 ;
  i < n + 1 ;
  i ++ ) {
    for ( int j = 0 ;
    j < m ;
    j ++ ) {
      if ( dis [ e [ j ] . from ] != inf && dis [ e [ j ] . to ] > dis [ e [ j ] . from ] + e [ j ] . cost ) {
        dis [ e [ j ] . to ] = dis [ e [ j ] . from ] + e [ j ] . cost ;
        if ( i == n && e [ j ] . to == n - 1 ) {
          return true ;
        }
      }
    }
  }
  return false ;
}

public static boolean bellmanFord ( ) { for ( int i = 0 ; i < n + 1 ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( dis [ e [ j ] . from ] != inf && dis [ e [ j ] . to ] > dis [ e [ j ] . from ] + e [ j ] . cost ) { dis [ e [ j ] . to ] = dis [ e [ j ] . from ] + e [ j ] . cost ; if ( i == n && e [ j ] . to == n - 1 ) { return true ; } } } } return false ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters) 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: (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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) right: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) right: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (return_statement (true)))))))))) (return_statement (false))))