111
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user