public BloomFilter(byte[] data,int entries,double error) throws RuntimeException {
  if (entries < 1 || ((1.0 <= error) || (error <= errorPrecision))) {
    throw new RuntimeException("Invalid params for bloom filter");
  }
  this.entries=entries;
  this.error=error;
  bpe=-(Math.log(error) / denom);
  bits=(int)((double)entries * bpe);
  bytes=(bits / 8) + (bits % 8 != 0 ? 1 : 0);
  if (data != null) {
    if (bytes != data.length) {
      throw new RuntimeException(String.format("Expected %d bytes, got %d",bytes,data.length));
    }
    bf=data;
  }
 else {
    bf=new byte[bytes];
    ;
  }
  hashes=(int)Math.ceil(0.693147180559945 * bpe);
}

public BloomFilter ( byte [ ] data , int entries , double error ) throws RuntimeException { if ( entries < 1 || ( ( 1.0 <= error ) || ( error <= errorPrecision ) ) ) { throw new RuntimeException ( "Invalid params for bloom filter" ) ; } this . entries = entries ; this . error = error ; bpe = - ( Math . log ( error ) / denom ) ; bits = ( int ) ( ( double ) entries * bpe ) ; bytes = ( bits / 8 ) + ( bits % 8 != 0 ? 1 : 0 ) ; if ( data != null ) { if ( bytes != data . length ) { throw new RuntimeException ( String . format ( "Expected %d bytes, got %d" , bytes , data . length ) ) ; } bf = data ; } else { bf = new byte [ bytes ] ; ; } hashes = ( int ) Math . ceil ( 0.693147180559945 * bpe ) ; }
create a bloom filter from an existing data buffer , created by another instance of this library ( probably in another language ) . if the length of the data does not fit the number of entries and error rate , we raise runtimeexception
