src/share/classes/java/lang/Integer.java

Print this page

        

*** 949,958 **** --- 949,959 ---- /** * Returns a hash code for a {@code int} value; compatible with * {@code Integer.hashCode()}. * + * @param value the value to hash * @since 1.8 * * @return a hash code value for a {@code int} value. */ public static int hashCode(int value) {
*** 1334,1343 **** --- 1335,1345 ---- * position of the highest-order ("leftmost") one-bit in the specified * {@code int} value. Returns zero if the specified value has no * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose highest one bit is to be computed * @return an {@code int} value with a single one-bit, in the position * of the highest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. * @since 1.5 */
*** 1356,1365 **** --- 1358,1368 ---- * position of the lowest-order ("rightmost") one-bit in the specified * {@code int} value. Returns zero if the specified value has no * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose lowest one bit is to be computed * @return an {@code int} value with a single one-bit, in the position * of the lowest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. * @since 1.5 */
*** 1380,1389 **** --- 1383,1393 ---- * <ul> * <li>floor(log<sub>2</sub>(x)) = {@code 31 - numberOfLeadingZeros(x)} * <li>ceil(log<sub>2</sub>(x)) = {@code 32 - numberOfLeadingZeros(x - 1)} * </ul> * + * @param i the value whose number of leading zeros is to be computed * @return the number of zero bits preceding the highest-order * ("leftmost") one-bit in the two's complement binary representation * of the specified {@code int} value, or 32 if the value * is equal to zero. * @since 1.5
*** 1406,1415 **** --- 1410,1420 ---- * one-bit in the two's complement binary representation of the specified * {@code int} value. Returns 32 if the specified value has no * one-bits in its two's complement representation, in other words if it is * equal to zero. * + * @param i the value whose number of trailing zeros is to be computed * @return the number of zero bits following the lowest-order ("rightmost") * one-bit in the two's complement binary representation of the * specified {@code int} value, or 32 if the value is equal * to zero. * @since 1.5
*** 1429,1438 **** --- 1434,1444 ---- /** * Returns the number of one-bits in the two's complement binary * representation of the specified {@code int} value. This function is * sometimes referred to as the <i>population count</i>. * + * @param i the value whose bits are to be counted * @return the number of one-bits in the two's complement binary * representation of the specified {@code int} value. * @since 1.5 */ public static int bitCount(int i) {
*** 1456,1465 **** --- 1462,1473 ---- * distance)}. Note also that rotation by any multiple of 32 is a * no-op, so all but the last five bits of the rotation distance can be * ignored, even if the distance is negative: {@code rotateLeft(val, * distance) == rotateLeft(val, distance & 0x1F)}. * + * @param i the value whose bits are to be rotated left + * @param distance the number of bit positions to rotate left * @return the value obtained by rotating the two's complement binary * representation of the specified {@code int} value left by the * specified number of bits. * @since 1.5 */
*** 1478,1487 **** --- 1486,1497 ---- * distance)}. Note also that rotation by any multiple of 32 is a * no-op, so all but the last five bits of the rotation distance can be * ignored, even if the distance is negative: {@code rotateRight(val, * distance) == rotateRight(val, distance & 0x1F)}. * + * @param i the value whose bits are to be rotated right + * @param distance the number of bit positions to rotate right * @return the value obtained by rotating the two's complement binary * representation of the specified {@code int} value right by the * specified number of bits. * @since 1.5 */
*** 1492,1501 **** --- 1502,1512 ---- /** * Returns the value obtained by reversing the order of the bits in the * two's complement binary representation of the specified {@code int} * value. * + * @param i the value to be reversed * @return the value obtained by reversing order of the bits in the * specified {@code int} value. * @since 1.5 */ public static int reverse(int i) {
*** 1511,1520 **** --- 1522,1532 ---- /** * Returns the signum function of the specified {@code int} value. (The * return value is -1 if the specified value is negative; 0 if the * specified value is zero; and 1 if the specified value is positive.) * + * @param i the value whose signum is to be computed * @return the signum function of the specified {@code int} value. * @since 1.5 */ public static int signum(int i) { // HD, Section 2-7
*** 1523,1532 **** --- 1535,1545 ---- /** * Returns the value obtained by reversing the order of the bytes in the * two's complement representation of the specified {@code int} value. * + * @param i the value whose bytes are to be reversed * @return the value obtained by reversing the bytes in the specified * {@code int} value. * @since 1.5 */ public static int reverseBytes(int i) {