本文整理汇总了Java中java.util.BitSet.toLongArray方法的典型用法代码示例。如果您正苦于以下问题:Java BitSet.toLongArray方法的具体用法?Java BitSet.toLongArray怎么用?Java BitSet.toLongArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.BitSet
的用法示例。
在下文中一共展示了BitSet.toLongArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePositon
import java.util.BitSet; //导入方法依赖的package包/类
@Test
public void changePositon(){
BitSet bitm =new BitSet(Constraints.Threshold_l);
bitm.set(6);
bitm.set(5);
System.out.println(bitm);
byte[] bytes = bitm.toByteArray();
long[] longs = bitm.toLongArray();
System.out.println(bytes[0]);
System.out.println(longs[0]);
int i = bytes[0] >>> 1;
// int i = byteArrayToInt(bytes);
// System.out.println(i);
// int num =i >> 1;
// System.out.println(num);
// byte[] bytes1 = intToByteArray(i);
// bitm = BitSet.valueOf(new byte[]{48});
// System.out.println(bitm);
}
示例2: changePositon2
import java.util.BitSet; //导入方法依赖的package包/类
@Test
public void changePositon2(){
BitSet bitm =new BitSet(16);
bitm.set(6);
bitm.set(5);
System.out.println(bitm);
long[] lo = bitm.toLongArray();
if(lo.length > 0){
for(int j=0;j<lo.length - 1;j++){
lo[j] = lo[j] >>> 1;
lo[j] = lo[j] | (lo[j+1] << 63);
}
lo[lo.length-1] = lo[lo.length-1] >>> 1;
}
bitm = BitSet.valueOf(lo);
System.out.println(bitm.size());
System.out.println(bitm);
}
示例3: NullComparator
import java.util.BitSet; //导入方法依赖的package包/类
public NullComparator(BitSet mask, int count) {
super();
this.bigs = mask.toLongArray();
if(mask.cardinality() == 0){
mode = Mode.NONE;
four = 0;
eight = 0;
}else{
if(count > 64){
mode = Mode.BIG;
four = 0;
eight = 0;
}else if(count > 32){
mode = Mode.EIGHT;
four = 0;
eight = bigs[0];
} else {
mode = Mode.FOUR;
four = (int) bigs[0];
eight = 0;
}
}
}
示例4: bitSetToInt
import java.util.BitSet; //导入方法依赖的package包/类
private int bitSetToInt(BitSet bitset){
int intValue = 0;
BitSet bitsetValue = bitset;
long[] data = bitsetValue.toLongArray();
if(data.length==1){
intValue = (int) data[0];
}
return intValue;
}
示例5: SynopsisHashMapAllDump
import java.util.BitSet; //导入方法依赖的package包/类
/**
* Hot word attenuation in hot words
*/
public void SynopsisHashMapAllDump(DumpRemoveHandler dumpRemoveHandler) {
int dumpsize = (int) (1 / Threshold_p);
dumpKeyCount++;
if (dumpKeyCount == dumpsize) {
//dump all key
Iterator<Map.Entry<String, BitSet>> iterator = predictHotKeyMap.newEntryIterator();
while (iterator.hasNext()){
Map.Entry<String, BitSet> next = iterator.next();
BitSet bitm = next.getValue();
String key = next.getKey();
if(key!=null){
long[] lo = bitm.toLongArray();
if(lo.length > 0){
for(int j=0;j<lo.length - 1;j++){
lo[j] = lo[j] >>> 1;
lo[j] = lo[j] | (lo[j+1] << 63);
}
lo[lo.length-1] = lo[lo.length-1] >>> 1;
}
bitm = BitSet.valueOf(lo);
if (bitm.isEmpty()) {
iterator.remove();
dumpRemoveHandler.dumpRemove(key);
}else
next.setValue(bitm);
}
}
dumpKeyCount = 0;
}
}
示例6: SynopsisHashMapRandomDump
import java.util.BitSet; //导入方法依赖的package包/类
/**
* New Words in Hot Words Random Dump
*/
public void SynopsisHashMapRandomDump(DumpRemoveHandler dumpRemoveHandler) {
int size=predictHotKeyMap.size;
long startTimeSystemTime=System.currentTimeMillis();
Iterator<Map.Entry<String, BitSet>> iterator = predictHotKeyMap.newEntryIterator();
while (iterator.hasNext()){
Map.Entry<String, BitSet> next = iterator.next();
if (random.nextDouble()> Threshold_p){
continue;
}
BitSet bitm = next.getValue();
String key = next.getKey();
if(key!=null){
long[] lo = bitm.toLongArray();
if(lo.length > 0){
for(int j=0;j<lo.length - 1;j++){
lo[j] = lo[j] >>> 1;
lo[j] = lo[j] | (lo[j+1] << 63);
}
lo[lo.length-1] = lo[lo.length-1] >>> 1;
}
bitm = BitSet.valueOf(lo);
if (bitm.isEmpty()) {
iterator.remove();
dumpRemoveHandler.dumpRemove(key);
}else
next.setValue(bitm);
}
}
}
示例7: longValue
import java.util.BitSet; //导入方法依赖的package包/类
/** Returns the lowest-order long in a BitSet **/
private static long longValue(@Nonnull BitSet bits) {
if (bits.length()>64) return Long.MAX_VALUE;
return bits.toLongArray()[0];
}