@@ -0,0 +1,1353 @@
+package main.java8.study.of.jdk.map.hashmap;%0A%0A/**%0A * Title : main.java8.study.of.jdk.map.hashmap %3Cbr%3E%0A * Description :%0A *  %3Cp%3E A instruction of method %7B@link java.util.HashMap#tableSizeFor(int)%7D%0A *  %3Cul%3E %0A *      %3Cli%3E%0A *  %3C/ul%3E%0A * @author chile%0A * @version 1.0%0A * @date 2018/3/20 16:49%0A */%0Apublic class MethodTableSizeFor %7B%0A%0A    /**%0A     * The maximum capacity, used if a higher value is implicitly specified%0A     * by either of the constructors with arguments.%0A     * MUST be a power of two %3C= 1%3C%3C30.%0A     */%0A    static final int MAXIMUM_CAPACITY = 1 %3C%3C 30;%0A%0A    /**%0A     * Returns a power of two size for the given target capacity.%0A     *%0A     * %3Cp%3E An ingenious method.%0A     *%0A     * %3Cp%3E What does this method do?%0A     * %3Cp%3E An number of int type, in binary string always looks like %3Cbr%3E%0A     *     0000 0000 0000 0000 1xxx xxxx xxxx xxxx %3Cbr%3E%0A     *     This method makes all of the %60x%60 equals to 1.%0A     *%0A     * %3Cp%3E How does this method work?%0A     * %3Cp%3E %3Ccode%3En %7C= n %3E%3E%3E x%3C/code%3E%0A     *     hahaha%0A     *     Not explained, could only be unspeakable.%0A     *     %5E_%5E%0A     */%0A    static final int tableSizeFor(int cap) %7B%0A        int n = cap - 1;%0A        n %7C= n %3E%3E%3E 1;%0A        n %7C= n %3E%3E%3E 2;%0A        n %7C= n %3E%3E%3E 4;%0A        n %7C= n %3E%3E%3E 8;%0A        n %7C= n %3E%3E%3E 16;%0A        return (n %3C 0) ? 1 : (n %3E= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;%0A    %7D%0A%0A%0A%0A%7D%0A

A instruction of method {@link java.util.HashMap#tableSizeFor(int)}