×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: Dec 10, 2020 7:44 PM
Views: 4610
Tags: array
  1.  
  2.     public static void main(String[] args) {
  3.         System.out.println(Arrays.toString(buildArray(0,100,5)));
  4.     }
  5.     public static double[] buildArray(double x0, double x1, int n){
  6.         var array = new double[n];
  7.         double schritte = (x1-x0)/(n-1);
  8.  
  9.         for (int i = 0; i < n; i++) {
  10.             array[i]=x0+i*schritte;
  11.         }
  12.         return array;
  13.     }
  14. }
  15.