GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — learnjava/Arrays.java at main · michaelkolesidis/learnjava Expand file tree/ Copy pathArrays.javaMore file actions 46 lines (33 loc) · 849 Bytes / Copy pathArrays.javaFile metadata and controls46 lines (33 loc) · 849 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 // Find the maximum of the array values double max = a[0]; for (int i = 1; i < a.length; i++) if (a[i] > max) max = a[i]; // Compute the average of the array values int N = a.length; double sum = 0.0; for (int i = 0; i < N; i++) sum += a[i]; double average = sum / N; // Copy to another array int N = a.length; double[] b = new double[N]; for (int i = 0; i < N; i++) b[i] = a[i]; // Reverse the elements within an array int N = a.length; for (int i = 0; i < N/2; i++) { double temp = a[i]; a[i] = a[N-1-i]; a[N-i-1] = temp; } // Matrix-matrix multiplication (square matrices) // a[][]*b[][] = c[][] int N = a.length; double[][] c = new double[N][N]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) { // Compute dot product of row i and column j. for (int k = 0; k < N; k++) c[i][j] += a[i][k]*b[k][j]; } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |