Lvg Java
2006p Version

gov.nih.nlm.nls.lvg.Util
Class Bit

java.lang.Object
  extended by gov.nih.nlm.nls.lvg.Util.Bit

public class Bit
extends java.lang.Object

This class provides methods of bit operations.

History:

Version:
V-2006p
Author:
NLM NLS Development Team

Constructor Summary
Bit()
           
 
Method Summary
static int Add(int b1, int b2)
          Add two integers bitwise.
static long Add(long b1, long b2)
          Add two long bitwise.
static boolean Contain(long container, long item)
          Determine if a long (container) contains another long (item).
static long Minus(long b1, long b2)
          Minus two long bitwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bit

public Bit()
Method Detail

Add

public static int Add(int b1,
                      int b2)
Add two integers bitwise. This operation is a bitwise exclusive or operation.

Parameters:
b1 - the first integer to be added
b2 - the second integer to be added
Returns:
result of bidwise addition of two integers.

Minus

public static long Minus(long b1,
                         long b2)
Minus two long bitwise. This operation is a bitwise operation. It take off bit if both bit are 1. keep the same as the first input, otherwise.

Parameters:
b1 - the first long to be deducted
b2 - the second long to deduct
Returns:
result of bidwise minus of two longs.

Add

public static long Add(long b1,
                       long b2)
Add two long bitwise. This operation is a bitwise exclusive or operation.

Parameters:
b1 - the first long to be added
b2 - the second long to be added
Returns:
result of bidwise addition of two longs.

Contain

public static boolean Contain(long container,
                              long item)
Determine if a long (container) contains another long (item). Contains means all bits with value of 1 in item is also 1 in the container Exclusive and is used for this bitwise contain operation.

Parameters:
container - the long container
item - the long containee
Returns:
true and false if container contains or not contain item.

Lvg Java
2006p Version

Submit a bug or feature

Copyright © 2006p National Library of Medicine