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.
2.byte to hexadecimal string representation programming principles and implementation methods are organized into blogs.
3. Define a function to calculate the and of all elements of an integer array.
4. Copy of the array.
5. Heap memory default is 1/4,
----------------------------------------
JAVA-XMX//Set heap memory max
-XMS//Set heap memory initial value
ClassName//class name
1.
Bit arithmetic
A = 3; B =-3
Binary form +3:0000 0011 take counter plus one -3:1111 1101
Signed move: A<<2 to the left two-bit 0000 11,000 binary is a b<<2 to the left two bits 1111 1000 binary Yes-12
A>>2 move right two bit 0000 0 binary Yes 0 b>>2 move right two bit 1111 11,110 binary Yes -1
Unsigned move: A<<<2 to the left two-bit 0000 11,000 binary is a b<<<2 left move two bits 1111 1000 binary Yes 12
A>>>2 move right two bit 0000 0 binary Yes 0 b>>>2 move right two bit 0011 11,110 binary Yes 63
2.
/*
* Byte Turn hex
* Hex each 0-f binary 4 bits so the byte is divided into two paragraphs, respectively, and 0000 1111 and &, the resulting value is hexadecimal number, the high position to the right four bit as low as the operation, and defines a hexadecimal character array, Let the high-status integer take the hexadecimal corresponding character as an array subscript and derive the return value. (Note that the return value is a concatenation string, and the return value type is string)
*/
Class byte2hexade{
public static void Main (string[] args) {
BYTE b=110;
System.out.print (Byte2hexade (b));
}
public static String Byte2hexade (Byte B1) {
int low =B1 & 0x0f;
int hig = (b1>>4) &0x0f;
char[] c=new char[]{' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' A ', ' B ', ' C ', ' D ', ' E ', ' F '};
Return ("+c[hig" + c[low]+ "");
}
}
3.
Class sumdemo{
public static void Main (string[] args) {
SUM (new int[]{1,3,5,7});
}
public static void sum (int[] arr) {
int sum=0;
for (int i=0; i<arr.length; i++) {
Sum=sum+arr[i];
}
SYSTEM.OUT.PRINTLN (sum);
}
}
4.
Class copyarray{
public static void Main (string[] args) {
Print (Copy (new int[]{2,4,6,8,10}));
}
public static int[] Copy (int[] arr) {
Int[] Arry=new int[arr.length];
for (int i=0; i<arr.length; i++) {
Arry[i]=arr[i];
}
return arry;
}
public static void print (int[] arr) {
for (int i=0; i<arr.length; i++) {
System.out.print (arr[i]+ "");
}
}
}
5. The default maximum space for heap memory is 1/4 of physical memory, and when running a Java program, you can set the maximum heap memory size by-xms The initial heap memory size-xmx;
This article is from the "Jobs" blog, so be sure to keep this source http://10718270.blog.51cto.com/10708270/1770791
Java Basics-fourth day jobs