本文整理了Java中java.lang.Integer.reverse()
方法的一些代码示例,展示了Integer.reverse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Integer.reverse()
方法的具体详情如下:
包路径:java.lang.Integer
类名称:Integer
方法名:reverse
[英]Reverses the order of the bits of the specified integer.
[中]反转指定整数位的顺序。
代码示例来源:origin: stackoverflow.com
byte bitsRev = (byte) (Integer.reverse(aByte) >>> (Integer.SIZE - Byte.SIZE));
代码示例来源:origin: com.h2database/h2
@Override
public Object read(ByteBuffer buff, int tag) {
switch (tag) {
case TAG_FLOAT_0:
return 0f;
case TAG_FLOAT_1:
return 1f;
case TAG_FLOAT_FIXED:
return buff.getFloat();
}
return Float.intBitsToFloat(Integer.reverse(DataUtils
.readVarInt(buff)));
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = Integer.reverse(SpreadFunctions.shortSpreadOne(element));
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
short keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(int element, int removedIndex)
{
int nextIndex = Integer.reverse(SpreadFunctions.intSpreadOne(element));
int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
int valueAtIndex = this.table[nextIndex];
if (valueAtIndex == element)
{
return nextIndex;
}
if (valueAtIndex == EMPTY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (valueAtIndex == REMOVED && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(int element, int removedIndex)
{
int nextIndex = Integer.reverse(SpreadFunctions.intSpreadOne(element));
int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
int valueAtIndex = this.table[nextIndex];
if (valueAtIndex == element)
{
return nextIndex;
}
if (valueAtIndex == EMPTY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (valueAtIndex == REMOVED && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = Integer.reverse(SpreadFunctions.shortSpreadOne(element));
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
short valueAtIndex = this.table[nextIndex];
if (valueAtIndex == element)
{
return nextIndex;
}
if (valueAtIndex == EMPTY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (valueAtIndex == REMOVED && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(float element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.floatSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
float keyAtIndex = this.keys[nextIndex];
if (Float.compare(keyAtIndex, element) == 0)
{
return nextIndex;
}
if (Float.compare(keyAtIndex, EMPTY_KEY) == 0)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(float element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.floatSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
float keyAtIndex = this.keys[nextIndex];
if (Float.compare(keyAtIndex, element) == 0)
{
return nextIndex;
}
if (Float.compare(keyAtIndex, EMPTY_KEY) == 0)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(float element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.floatSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
float keyAtIndex = this.keys[nextIndex];
if (Float.compare(keyAtIndex, element) == 0)
{
return nextIndex;
}
if (Float.compare(keyAtIndex, EMPTY_KEY) == 0)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: lealone/Lealone
@Override
public Value readValue(ByteBuffer buff, int tag) {
switch (tag) {
case TAG_FLOAT_0:
return ValueFloat.get(0f);
case TAG_FLOAT_1:
return ValueFloat.get(1f);
case TAG_FLOAT_FIXED:
return ValueFloat.get(buff.getFloat());
}
return ValueFloat.get(Float.intBitsToFloat(Integer.reverse(DataUtils.readVarInt(buff))));
}
};
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(int element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.intSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
int keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(char element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.charSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
char keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.shortSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
short keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.shortSpreadOne(element) << 1;
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask((nextIndex >> 1) + spreadTwo) << 1;
short keyAtIndex = this.keysValues[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(char element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.charSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1;
while(true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
char keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.shortSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
short keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(char element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.charSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
char keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: goldmansachs/gs-collections
int probeThree(short element, int removedIndex)
{
int nextIndex = (int) SpreadFunctions.shortSpreadOne(element);
int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1;
while (true)
{
nextIndex = this.mask(nextIndex + spreadTwo);
short keyAtIndex = this.keys[nextIndex];
if (keyAtIndex == element)
{
return nextIndex;
}
if (keyAtIndex == EMPTY_KEY)
{
return removedIndex == -1 ? nextIndex : removedIndex;
}
if (keyAtIndex == REMOVED_KEY && removedIndex == -1)
{
removedIndex = nextIndex;
}
}
}
代码示例来源:origin: lealone/Lealone
private void write0(DataBuffer buff, float x) {
int f = Float.floatToIntBits(x);
if (f == FLOAT_ZERO_BITS) {
buff.put((byte) TAG_FLOAT_0);
} else if (f == FLOAT_ONE_BITS) {
buff.put((byte) TAG_FLOAT_1);
} else {
int value = Integer.reverse(f);
if (value >= 0 && value <= DataUtils.COMPRESSED_VAR_INT_MAX) {
buff.put((byte) FLOAT).putVarInt(value);
} else {
buff.put((byte) TAG_FLOAT_FIXED).putFloat(x);
}
}
}
代码示例来源:origin: com.h2database/h2
@Override
public void write(WriteBuffer buff, Object obj) {
if (!(obj instanceof Float)) {
super.write(buff, obj);
return;
}
float x = (Float) obj;
int f = Float.floatToIntBits(x);
if (f == ObjectDataType.FLOAT_ZERO_BITS) {
buff.put((byte) TAG_FLOAT_0);
} else if (f == ObjectDataType.FLOAT_ONE_BITS) {
buff.put((byte) TAG_FLOAT_1);
} else {
int value = Integer.reverse(f);
if (value >= 0 && value <= DataUtils.COMPRESSED_VAR_INT_MAX) {
buff.put((byte) TYPE_FLOAT).putVarInt(value);
} else {
buff.put((byte) TAG_FLOAT_FIXED).putFloat(x);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!