Android: & gt; use of symbols and & amp; To obtain actio under multi-touch

Source: Internet
Author: User

/**
* This method is used to convert between hexadecimal, binary, hexadecimal, and decimal.
* @ Param args
*/
// The following is a binary conversion hexadecimal table.
// 0001 1 1000 8 1111 F
// 0010 2 1001 9
// 0011 1010
// 0100 4 1011 B
// 0101 1100 C
// 0110 6 1101 D
// 0111 7 1110 E
Public static void main (String [] args ){
// Decimal 261
Int x = 261; // convert to hexadecimal: 105 261/16 105 = 16 to 5 16 = 10 10 splice the remainder 5 =
// 105: 0000 0001 0000 0101
// Ff00: 1111 1111 0000 0000
// Result: 0000 0001 0000 0000
// >>> 8: 0000 0001
 
// 0x00000105 0x000000 0001 0000 0101
// 0x000000 0001 0000 0000
// 0x0000 0001 move the binary code eight places to the right
// 101/2 = 10 binary divided by 2 is equivalent to moving the binary code one bit to the right
 
Int y = 0xff00; // 0x is the prefix of the hexadecimal code. ff00 is converted to binary = 1111111100000000.
// & Binary bitwise AND OPERATION
// >>> This symbol indicates moving the specified number of digits to the right (8 digits)
Int z = (x & y) >>> 8;
// X = 261 SIXTEEN: 0105 binary: 0000000100000101
// Y = 0xff00: 16: ff00 binary: 1111111100000000
// After x & y, multiply the upper and lower values of x and y to get the result: 0000000100000000.
// Then: (x & y) >>> 8 shifted to the right, and 8 digits: 00000001
 
 
System. out. println ("finger number is" + z );
 
Int w = x & 0x00ff;
// X = 261 SIXTEEN: 0105 binary: 0000000100000101
// Y = 0x00ff: 16: ff00 binary: 0000000011111111
// After x & y is multiplied by x and y, the result is: 0000000000000101 the JVM automatically converts the binary into decimal.
 
System. out. println ("Finger action" + w );

}
 
Through the above operations, we have simplified the finger movement under multi-point touch to get the value we want.


From sharme's column

Related Article

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.