Bitwise operators :
>>> unsigned right-shift operators, rules for unsigned right shifts, and rules to move right also, just as the fill, no matter whether the original positive or negative are added with the zero.
Array:
ARR1=ARR2; At this point two array variables will point to the same array at the same time, that is, the array pointed to by ARR2, assuming arr2 points to the array changes, then arr1 and arr2 are changed.
Use Arrays.sort to sort (using a quick row)
Magic square Matrix : (direct to instance)
public class Magic {/** * uses multidimensional arrays to print an n-order magic square Matrix * The sum of the data elements on each column and diagonal of each row of the matrix * n takes an odd number (because of the diagonal and the row and column and equal) */public void mag (int n,int a[] [])//Pass order number and array {int i = 0, j, k;j = n/2;for (k = 1; k <= n * N; k++) {A[i][j] = K;//system.out.print ("a[" +i+ "[" +j+ "]=" +a[i][j]+ ""); if (k% n = = 0) {i = (i + 1)% n;} else {i = (i-1 + N)% N;j = (j + 1)% n;}}} public static void Main (string[] args) {int n=3;int a[][] = new Int[n][n];new Magic (). Mag (n, a);//system.out.println (); for (int i = 0; i < n; i++) {for (int j = 0; J <n; J + +) {System.out.print (a[i][j]+ "\ t");} System.out.println ();}}}
Example Results:
8 1 6
3 5 7
4 9 2
Java Small Knowledge Point learning--------array and bit arithmetic small knowledge points