private void checkFloat(float value) {
    int key = r.nextInt();

    DatatableFloat f = new DatatableFloat(key);

    f.set(value);

    checkFloat(f, key, value);

    byte[] compressed = f.compress();

    assertTrue("Compressed array wrong length", compressed.length == 4);

    int key2 = r.nextInt();

    DatatableFloat b2 = new DatatableFloat(key2);

    b2.decompress(compressed);

    checkFloat(b2, key2, value);
  }
  private void checkFloat(DatatableFloat f, int key, float value) {

    assertTrue("Wrong key, got " + f.hashCode() + ", expected " + key, f.hashCode() == key);

    assertTrue("Wrong value", f.get().equals(new Float(value)));

    assertTrue("Wrong value as bool", f.asBool() == (value != 0.0F));

    assertTrue("Wrong value as float", f.asFloat() == value);

    assertTrue("Wrong value as int", f.asInt() == (int) value);
  }