public static void main ( String [ ] args ) {
  int n = 4 ;
  double x [ ] = {
    45 , 50 , 55 , 60 };
    double y [ ] [ ] = new double [ n ] [ n ] ;
    y [ 0 ] [ 0 ] = 0.7071 ;
    y [ 1 ] [ 0 ] = 0.7660 ;
    y [ 2 ] [ 0 ] = 0.8192 ;
    y [ 3 ] [ 0 ] = 0.8660 ;
    for ( int i = 1 ;
    i < n ;
    i ++ ) {
      for ( int j = 0 ;
      j < n - i ;
      j ++ ) y [ j ] [ i ] = y [ j + 1 ] [ i - 1 ] - y [ j ] [ i - 1 ] ;
    }
    for ( int i = 0 ;
    i < n ;
    i ++ ) {
      System . out . print ( x [ i ] + "\t" ) ;
      for ( int j = 0 ;
      j < n - i ;
      j ++ ) System . out . print ( y [ i ] [ j ] + "\t" ) ;
      System . out . println ( ) ;
    }
    double value = 52 ;
    double sum = y [ 0 ] [ 0 ] ;
    double u = ( value - x [ 0 ] ) / ( x [ 1 ] - x [ 0 ] ) ;
    for ( int i = 1 ;
    i < n ;
    i ++ ) {
      sum = sum + ( u_cal ( u , i ) * y [ 0 ] [ i ] ) / fact ( i ) ;
    }
    System . out . println ( "\n Value at " + value + " is " + String . format ( "%.6g%n" , sum ) ) ;
  }
  
public static void main ( String [ ] args ) { int n = 4 ; double x [ ] = { 45 , 50 , 55 , 60 } ; double y [ ] [ ] = new double [ n ] [ n ] ; y [ 0 ] [ 0 ] = 0.7071 ; y [ 1 ] [ 0 ] = 0.7660 ; y [ 2 ] [ 0 ] = 0.8192 ; y [ 3 ] [ 0 ] = 0.8660 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - i ; j ++ ) y [ j ] [ i ] = y [ j + 1 ] [ i - 1 ] - y [ j ] [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( x [ i ] + " \t " ) ; for ( int j = 0 ; j < n - i ; j ++ ) System . out . print ( y [ i ] [ j ] + " \t " ) ; System . out . println ( ) ; } double value = 52 ; double sum = y [ 0 ] [ 0 ] ; double u = ( value - x [ 0 ] ) / ( x [ 1 ] - x [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { sum = sum + ( u_cal ( u , i ) * y [ 0 ] [ i ] ) / fact ( i ) ; } System . out . println ( " \n ▁ Value ▁ at ▁ " + value + " ▁ is ▁ " + String . format ( " % .6g % n " , sum ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (floating_point_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (decimal_floating_point_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (decimal_floating_point_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (decimal_floating_point_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)) right: (decimal_floating_point_literal))) (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 (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: (identifier))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal))))) (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: (identifier))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))))) (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: (binary_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))) right: (array_access array: (array_access array: (identifier) index: (decimal_integer_literal)) index: (identifier)))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier)))))))))