本文整理了Java中java.lang.Integer.rotateRight()
方法的一些代码示例,展示了Integer.rotateRight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Integer.rotateRight()
方法的具体详情如下:
包路径:java.lang.Integer
类名称:Integer
方法名:rotateRight
[英]Rotates the bits of the specified integer to the right by the specified number of bits.
[中]将指定整数的位向右旋转指定位数。
代码示例来源:origin: MovingBlocks/Terasology
@Override
public int get(int src) {
// RGBA becomes ARGBA by a simple rotation
return Integer.rotateRight(src, Byte.SIZE);
}
代码示例来源:origin: lealone/Lealone
private static int rot(int i, int count) {
return Integer.rotateRight(i, count);
}
代码示例来源:origin: stackoverflow.com
int n = 0x55005500; // Binary 01010101000000000101010100000000
int k = 13;
System.err.printf("%08x%n", Integer.rotateRight(n, k));
代码示例来源:origin: com.h2database/h2
private void decryptBlock(byte[] in, byte[] out, int off) {
int x0 = Bits.readInt(in, off);
int x1 = Bits.readInt(in, off + 4);
int x2 = Bits.readInt(in, off + 8);
int x3 = Bits.readInt(in, off + 12);
int k = key;
x1 = Integer.rotateRight(x1, x0) ^ k;
x3 = Integer.rotateRight(x3, x0) ^ k;
x0 = Integer.rotateRight(x0, x1) ^ k;
x2 = Integer.rotateRight(x2, x1) ^ k;
Bits.writeInt(out, off, x0);
Bits.writeInt(out, off + 4, x1);
Bits.writeInt(out, off + 8, x2);
Bits.writeInt(out, off + 12, x3);
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
{ c = rotateRight( c, 30); a -= s4(b, c, d, e,w2[ 64]);}
{ d = rotateRight( d, 30); b -= s4(c, d, e, a,w2[ 63]);}
{ e = rotateRight( e, 30); c -= s4(d, e, a, b,w2[ 62]);}
{ a = rotateRight( a, 30); d -= s4(e, a, b, c,w2[ 61]);}
{ b = rotateRight( b, 30); e -= s4(a, b, c, d,w2[ 60]);}
{ c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 59]);}
{ d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 58]);}
{ e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 57]);}
{ a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 56]);}
{ b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 55]);}
{ c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 54]);}
{ d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 53]);}
{ e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 52]);}
{ a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 51]);}
{ b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 50]);}
{ c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 49]);}
{ d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 48]);}
{ e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 47]);}
{ a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 46]);}
{ b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 45]);}
{ c = rotateRight( c, 30); a -= s3(b, c, d, e,w2[ 44]);}
{ d = rotateRight( d, 30); b -= s3(c, d, e, a,w2[ 43]);}
{ e = rotateRight( e, 30); c -= s3(d, e, a, b,w2[ 42]);}
{ a = rotateRight( a, 30); d -= s3(e, a, b, c,w2[ 41]);}
{ b = rotateRight( b, 30); e -= s3(a, b, c, d,w2[ 40]);}
{ c = rotateRight( c, 30); a -= s2(b, c, d, e,w2[ 39]);}
代码示例来源:origin: net.mikera/mikera
public int hashCode() {
int result=0;
for(int i=0; i<count; i++) {
result^=data[i];
result=Integer.rotateRight(result, 1);
}
return result;
}
代码示例来源:origin: jpcsp/jpcsp
private int getScrambleDataSector(long fuseId, int partitionNumber) {
if (partitionNumber == 3) {
return 0x3C22812A;
}
int scramble = ((int) fuseId) ^ Integer.rotateRight((int) (fuseId >> 32), partitionNumber * 3);
scramble ^= 0x556D81FE;
if (scramble == 0) {
scramble = Integer.rotateRight(0x556D81FE, partitionNumber);
}
return scramble;
}
代码示例来源:origin: stackoverflow.com
public static int encrypt(int value, byte key) {
int result=value;
for (int i=0; i<=(key&255); i++) {
result=Integer.rotateRight(result,7)^(i+0xCAFEBABE);
}
return result;
}
代码示例来源:origin: net.mikera/mikera
public static <T> int hashCode(T[] data) {
int result=0;
for(int i=0; i<data.length; i++) {
result^=data[i].hashCode();
result=Integer.rotateRight(result, 1);
}
return result;
}
代码示例来源:origin: stackoverflow.com
public static <T> int hashCode(T[] data) {
int result=0;
for(int i=0; i<data.length; i++) {
result^=data[i].hashCode();
result=Integer.rotateRight(result, 1);
}
return result;
}
代码示例来源:origin: stackoverflow.com
public class Binary {
public static void main(String[] args) {
Integer i = 18;
System.out.println(Integer.toBinaryString(i));
i = Integer.rotateRight(i, 2);
System.out.println(Integer.toBinaryString(i));
}
}
代码示例来源:origin: com.github.blasd.apex/apex-java
public static final int positiveUnpack2(long packed) {
// Move the higher bit as lower bit: if packed >= 0, we then are sure to have a 0 as first bit
// Then, this 0 bit it put back as last bit: the integer is guaranteed to be positive
return Integer.rotateRight((int) (Long.rotateLeft(packed, 1) & MASK), 1);
}
代码示例来源:origin: net.mikera/mikera
public static<T> int hashCode(Iterator<T> data) {
int result=0;
while(data.hasNext()) {
result^=hashCodeWithNulls(data.next());
result=Integer.rotateRight(result, 1);
}
return result;
}
代码示例来源:origin: com.github.cormoran-io.pepper/pepper
public static final int positiveUnpack2(long packed) {
// Move the higher bit as lower bit: if packed >= 0, we then are sure to have a
// 0 as first bit
// Then, this 0 bit it put back as last bit: the integer is guaranteed to be
// positive
return Integer.rotateRight((int) (Long.rotateLeft(packed, 1) & MASK), 1);
}
代码示例来源:origin: net.imagej/ij
/** Returns a hashcode for this Roi that typically changes
if it is moved, even though it is still the same object. */
public int getHashCode() {
return hashCode() ^ (new Double(getXBase()).hashCode()) ^
Integer.rotateRight(new Double(getYBase()).hashCode(),16);
}
代码示例来源:origin: jtransc/jtransc
static private void testBitsOps() {
System.out.println("testBitsOps:");
System.out.println("Integer.bitCount:" + Integer.bitCount(0x12345678));
System.out.println("Integer.reverse:" + Integer.reverse(0x12345678));
System.out.println("Integer.reverse:" + Integer.reverse(0xF2345678));
System.out.println("Integer.reverseBytes:" + Integer.reverseBytes(0x12345678));
System.out.println("Integer.reverseBytes:" + Integer.reverseBytes(0xF2345678));
System.out.println("Integer.rotateLeft:" + Integer.rotateLeft(0x12345678, 13));
System.out.println("Integer.rotateRight:" + Integer.rotateRight(0xF2345678, 27));
System.out.println("Short.reverseBytes:" + Short.reverseBytes((short) 0x1234));
System.out.println("Short.reverseBytes:" + Short.reverseBytes((short) 0xF234));
}
代码示例来源:origin: jpcsp/jpcsp
public final void doWSBH(int rd, int rt) {
if (rd != 0) {
setRegister(rd, Integer.rotateRight(Integer.reverseBytes(getRegister(rt)), 16));
}
}
代码示例来源:origin: net.mikera/mikera
public int hashCode() {
if (blocks.length==0) return 0;
int r=blocks[0].hashCode();
for (int i=1; i<blocks.length; i++) {
r=Integer.rotateRight(r,blocks[i].size());
r^=blocks[i].hashCode();
}
return r;
}
代码示例来源:origin: jpcsp/jpcsp
public final void doROTRV(int rd, int rt, int rs) {
if (rd != 0) {
// no need of "getRegister(rs) & 31", rotateRight does it for us
setRegister(rd, Integer.rotateRight(getRegister(rt), getRegister(rs)));
}
}
代码示例来源:origin: net.mikera/mikera
public int hashCode() {
int r= Integer.rotateRight(front.hashCode(),back.size());
r^=back.hashCode();
return r;
}
}
内容来源于网络,如有侵权,请联系作者删除!