Example usage for org.apache.lucene.util.packed PackedInts maxValue

List of usage examples for org.apache.lucene.util.packed PackedInts maxValue

Introduction

In this page you can find the example usage for org.apache.lucene.util.packed PackedInts maxValue.

Prototype

public static long maxValue(int bitsPerValue) 

Source Link

Document

Calculates the maximum unsigned long that can be expressed with the given number of bits.

Usage

From source file:org.yipeng.test.util.packed.TestPackedInts.java

License:Apache License

public void testMaxValues() {
    assertEquals("1 bit -> max == 1", 1, PackedInts.maxValue(1));
    assertEquals("2 bit -> max == 3", 3, PackedInts.maxValue(2));
    assertEquals("8 bit -> max == 255", 255, PackedInts.maxValue(8));
    assertEquals("63 bit -> max == Long.MAX_VALUE", Long.MAX_VALUE, PackedInts.maxValue(63));
    assertEquals("64 bit -> max == Long.MAX_VALUE (same as for 63 bit)", Long.MAX_VALUE,
            PackedInts.maxValue(64));/*  www.  j a v  a  2 s  .  com*/
}