coins.backend.util
Class Misc

java.lang.Object
  extended bycoins.backend.util.Misc

public class Misc
extends java.lang.Object

Miscellaneous functions


Constructor Summary
Misc()
           
 
Method Summary
static int binlog(int pattern)
          Return rightmost 1's position
static int binlog(long pattern)
          Return binary logarithm.
static int clp2(int x)
          Round up to next powers of 2.
static int count1s(int x)
          Return number of 1's in x.
static boolean powersOf2(long x)
          Return true if x is powers of 2.
static void sort(int[] a, int n)
          Sort integer vector in ascending order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Misc

public Misc()
Method Detail

sort

public static void sort(int[] a,
                        int n)
Sort integer vector in ascending order.


clp2

public static int clp2(int x)
Round up to next powers of 2.

Parameters:
x - number to be rounded up.
Returns:
next powers of 2 greater than or equal to x.

powersOf2

public static boolean powersOf2(long x)
Return true if x is powers of 2.


binlog

public static int binlog(long pattern)
Return binary logarithm.


binlog

public static int binlog(int pattern)
Return rightmost 1's position


count1s

public static int count1s(int x)
Return number of 1's in x.