Tag：Secondary power

Time：202059
//Judge whether an integer is the nth power of 2 private boolean is2N(int num) { return (num & (num – 1)) == 0; } //To judge whether a positive integer is odd or even, it is not divided by 2 private boolean isEvenNumber(int num) { return (num & 1) == 0; } 338：https://leetcodecn.com/probl… Given a […]

Time：202048
subjectThere are small squares that can be represented by the string s consisting of the characters’ l ‘and’ R ‘.The length of string s is n, that is to say, string s is arranged in a row from left to right by n small squares. The content of the ith cell from left to right […]

Time：2020224
Source code of HashMap: android25 / Java / util / HashMap 1、 Construction method static final int MAXIMUM_CAPACITY = 1 << 30; static final int DEFAULT_INITIAL_CAPACITY = 4; static final float DEFAULT_LOAD_FACTOR = 0.75f; public HashMap() { this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR); } //Parameter default is 4,0.75f public HashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw […]

Time：2020122
Common methods of Java math class Java.lang.math provides some common mathematical operation methods, and they all exist in the form of static methods Step 1:Rounding, random number, square, power, π, natural constant package digit; public class TestNumber { public static void main(String[] args) { float f1 = 5.4f; float f2 = 5.5f; //5.4 rounding to […]

Time：2019912
Computer and Artificial Intelligence, Computer Systems: Working Principle of Computer:The basic principle of computer is to store program and program control. In advance, the sequence of instructions (called program) and the original data that command how the computer operates are transmitted to the computer memory through the input device. Each instruction specifies which address […]