Class HeapUtil
- java.lang.Object
-
- elki.utilities.datastructures.heap.HeapUtil
-
public final class HeapUtil extends java.lang.ObjectNext power of 2, for heaps.Usually, you should prefer the version in the
MathUtilclass. This copy exists to avoid depending onto math from these data structures.- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private static intMAX_ARRAY_SIZEMaximum Java array size according to some sources.
-
Constructor Summary
Constructors Modifier Constructor Description privateHeapUtil()Private constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intnextPow2Int(int x)Find the next power of 2.static intnextSize(int current)Next size if a heap exceeds the current capacity.
-
-
-
Field Detail
-
MAX_ARRAY_SIZE
private static final int MAX_ARRAY_SIZE
Maximum Java array size according to some sources.- See Also:
- Constant Field Values
-
-
Method Detail
-
nextPow2Int
public static int nextPow2Int(int x)
Find the next power of 2.Classic bit operation, for signed 32-bit. Valid for positive integers only (0 otherwise).
- Parameters:
x- original integer- Returns:
- Next power of 2
-
nextSize
public static int nextSize(int current)
Next size if a heap exceeds the current capacity.- Parameters:
current- Current capacity- Returns:
- next heap size
-
-