You are here: home > download
 
home
 
tutorials
   random picture chooser
   bitwise operators in java
   email spam protection
 
tools
   ping
   http client info
 
links
 
download
 
contact
 
 
Download

download this   BitArray.java
 

I didn't like java.util.BitSet, because it doesn't have the intuitive array-like behaviour, so I wrote this snippet, which works all alone, including possibility to load data from files bitwise.

From the javadoc comment on the class:

/**
 * This class is mostly like java.util.BitSet, just a bit more intuitive. Think
 * of it as a mutable string of bits which can grow and shrink in length.
 * 
* In this class, bits are stored in so called storage units. Depending on your * processor type, int or long might be best to use as storage type. *
* The bits in the storage units have MSb (most significant bit) first bit * order. This means that the bit at index 0 in this BitArray is the most * significant bit of the first storage unit. For int and long, this is the * sign-bit. *
* This class is not snychronized. If you want to access instances of this class * asynchronously from multiple threads, you have to synchronize access in your * own code. * * So far, this is a beta version. As of today (Sat, 2007-12-31), it's most * likely that it still contains bugs. */


download this   CompleteReader.java
 
A class with utility methods for reading a number of bytes and blocking until they are available.


download this   BitShuffler.java
 
Class with static utility methods for bitwise data manipulation and dumping, mostly for byte arrays.