1. Sort the bitwise operations, especially the left and right shifts (with or without symbols) to your blog.
The emphasis is on the operation process of clear negative numbers.
/*
Class Demo {
public static void Main (string[] arge) {
int a =-4; 1111 1100
int B = a >> 2;//1111 1111
int B = A >>> 2 0011 1111
System.out.println (b);
}
}
*/
2.byte to hexadecimal string representation programming principles and implementation methods are organized into blogs.
Class Demo {
public static void Main (string[] arge) {
byte A = 28;
byte low = (Byte) (A & 0x0f);
byte hight = (byte) ((A & 0xf0) >>4);
Char[] Array = {' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' A ', ' B ', ' C ', ' D ', ' E ', ' F '};
System.out.println ("0x" + array[hight] + array[low]);
}
}
*/
3. Define a function to calculate the and of all elements of an integer array.
Package forth_day;
/**
* Define functions to calculate the and of all elements of an integer array
*
* @author Admin
*
*/
public class Sum {
public int sumdata (int[] arr) {
int temp = 0;
for (int i = 0; i < arr.length; i++) {
Temp = temp + arr[i];
}
return temp;
}
public static void Main (string[] args) {
Sum sum = new sum ();
Int[] arr = {5, 1, 4, 5, 2, 4, 77, 54, 12, 52, 55};
int result = Sum.sumdata (arr);
SYSTEM.OUT.PRINTLN (result);
}
}
4. Copying of arrays
Package forth_day;/**4. Copy of the array * @author Admin * */public class CopyData {public int[] Copy_data (int[] arr) {int[] Copyrst = New Int[arr.length];for (int i = 0; i < arr.length; i++) {copyrst[i] = arr[i];} return Copyrst;} public static void Main (string[] args) {int[] arr = {4, 8, 5, 9999};int[] result=new copydata (). Copy_data (arr); for (int i = 0; i < result.length; i++) {System.out.print (result[i]+ "");}}}
5. Heap memory default is 1/4,
----------------------------------------
JAVA-XMX//Set heap memory max
-XMS//Set heap memory initial value
ClassName//class name
A: The default maximum heap memory is 1/4 of physical memory, when running a Java program, you can-xms the initial heap memory size,-XMX set the maximum heap memory size;
Java Foundation Fourth day