org.nutz.lang
类 Maths

java.lang.Object
  继承者 org.nutz.lang.Maths

public abstract class Maths
extends java.lang.Object

A group of helper functions to counting some ...

作者:
zozoh(zozohtnt@gmail.com)

构造方法摘要
Maths()
           
 
方法摘要
static int bit(java.lang.String s)
          Convert a binary string to a integer
static int extract(int bs, int low, int high)
          Get part of one integer as a new integer
static boolean isMask(int bs, int mask)
          Test current bit is match the given mask at least one bit or not.
static boolean isMaskAll(int bs, int mask)
          Test current bit is all match the give mask.
static boolean isNoMask(int bs, int mask)
           
static int max(int... nums)
          Seek the maximum number from an INT array
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Maths

public Maths()
方法详细信息

max

public static int max(int... nums)
Seek the maximum number from an INT array

参数:
nums - INT array
返回:
the maximum

bit

public static int bit(java.lang.String s)
Convert a binary string to a integer

参数:
s - binary string
返回:
integer

isMask

public static boolean isMask(int bs,
                             int mask)
Test current bit is match the given mask at least one bit or not.

参数:
bs - integer, bit map
mask - another bit map
返回:
if one of bit value is '1' in mask, and it is also is '1' in bs return true, else false

isNoMask

public static boolean isNoMask(int bs,
                               int mask)

isMaskAll

public static boolean isMaskAll(int bs,
                                int mask)
Test current bit is all match the give mask.

参数:
bs - integer, bit map
mask - another bit map
返回:
if all bit value is '1' in mask, and it is also is '1' in bs return true, else false

extract

public static int extract(int bs,
                          int low,
                          int high)
Get part of one integer as a new integer

参数:
bs - original integer
low - the low bit position (inclusive), 0 base
high - the hight bit position (exclusive), 0 base
返回:
new integer