Program apes are very lazy, you know!What we are sharing today is the integer wrapper class. In real-world development, we often need to operate an integer, or a variety of conversions and so on. I will give you a specific explanation of the use of
Basic Concepts
The level of a node is defined from the root. The root layer is the first layer, and the child of the root layer is the second layer.
The height of a binary tree: the maximum level of a node in the tree is called the depth or height
Calculates the number of binary 1 in an integer, and the number of binary 1 in an integer.
Question: evaluate an integer binary to represent the number of 1
First version:
Idea: if an integer is compared with 1, and the result is 1, the rightmost
2010 to 11-3018: 40: 24
28. The binary value of an integer indicates the number of values in 1.Question: enter an integer to calculate the number of 1 in the Binary Expression of this integer.For example, input 10. Because the binary value is 1010
odd-even segmented arrays
Splits an array of integers so that the odd number is behind the first even number. Sample Example
Given [1, 2, 3, 4], return [1, 3, 2, 4]. algorithm
This problem is still relatively simple, the method is many, we will
Integer source code to binary to hexadecimal, integer source code
There is a private method, where toUnsignedString (int I, int shift) isPublic static String toHexString (int I ){Return toUnsignedString (I, 4 );}Public static String toBinaryString (
Evaluate the number of 1 in the binary of an integer.
Question: enter an integer to calculate the number of 1 in the Binary Expression of this integer. For example, input 10. Because the binary value is 1010 and there are two 1 s, Output 2.
Analysis:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.ObjectiveMainly used for color integer, RGB array, 16 binary conversion (-12590395 #3FE2C5 [63,226,197])No need for temporaryCode
Document directory
Unsigned integer Compression Algorithm
Unsigned integer decompression algorithm
Algorithm for compressing signed integers
Algorithm for extracting signed integers
ILASM/ILDASM
Mono Cecil
CCI Metadata
Other
Explanation: mutual conversion of binary, octal, decimal, and hexadecimal values: in addition to the remainder of 2, the integers are arranged in reverse order, that is, each time an integer is divided by 2, and the remainder is the number on the
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.