This commit is contained in:
hz21056617
2022-02-22 17:25:57 +08:00
parent a9a081bc8a
commit c68f07d453
2 changed files with 32 additions and 1 deletions
@@ -0,0 +1,25 @@
package concurrent.hashmap;
import org.junit.jupiter.api.Test;
public class HashMapTest {
static final int MAXIMUM_CAPACITY = 1 << 30;
@Test
public void LinkedBlockingQueueModelTest() throws InterruptedException {
System.out.println(tableSizeFor(1000));
}
static final int tableSizeFor(int cap) {
int n = cap - 1;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
int t = (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
return t;
}
}
+7 -1
View File
@@ -15,5 +15,11 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>
</project>