Ava Foundation Fourth day

Source: Internet
Author: User
Tags xms

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.

/*

Class Demo {

public static void Main (string[] arge) {

Int[] array = {2,3,5,10};

int sum = 0;

for (int a=0; a<array.length;++a) {

Sum+=array[a];

}

SYSTEM.OUT.PRINTLN (sum);

}

}


*/

4. Copy of the array.


Class Demo {

public static void Main (string[] arge) {

Int[] array = {2,3,5,10};

int[] Arrayback = new Int[array.length];

for (int a=0; a<arrayback.length;++a) {

Arrayback[a] = Array[a];

}

for (int a=0; a<arrayback.length;++a) {

System.out.print (Arrayback[a] + "");

}

}

}



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;


Ava Foundation Fourth day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.