Top Constructors Methods
rx.internal.util.unsafe

public final Class Pow2

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private
Pow2()

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the value is a power of 2 otherwise false.
isPowerOfTwo
(final int
to be tested to see if it is a power of two.
value
)

Is this value a power of two.

public static int

Returns:

the next positive power of 2 or this value if it is a power of 2.
roundToPowerOfTwo
(final int
from which next positive power of two will be found.
value
)

Find the next larger positive power of two value up from the given value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Pow2back to summary
private Pow2()

Method Detail

isPowerOfTwoback to summary
public static boolean isPowerOfTwo(final int value)

Is this value a power of two.

Parameters
value:int

to be tested to see if it is a power of two.

Returns:boolean

true if the value is a power of 2 otherwise false.

roundToPowerOfTwoback to summary
public static int roundToPowerOfTwo(final int value)

Find the next larger positive power of two value up from the given value. If value is a power of two then this value will be returned.

Parameters
value:int

from which next positive power of two will be found.

Returns:int

the next positive power of 2 or this value if it is a power of 2.