我有以下代码:
public class Testcode {
private static final Long[] P = new Long[18];
public void setKey( string key )
{
integer i, j, k;
long data;
integer N = 16;
string[] keytemp = new string[]{};
keytemp.add(key);
// Initialize P and S.
for ( i = 0; i < N + 2; ++i ){
P[i] = Pinit[i];
}
// XOR the key into P.
j = 0;
for ( i = 0; i < N + 2; ++i )
{
data = 0;
for ( k = 0; k < 4; ++k )
{
data = ( data << 8 ) | keytemp[j];
++j;
}
P[i] ^= data;
}
}
private static final long[] Pinit = new Long[] {
604135516L, 2242044355L, 320440478L , 57401183L,
2732047618L, 698298832L, 137296536L , 3964563569L,
1163258022L, 954160567L, 3193502383L, 887688400L,
3234508543L, 3380367581L, 1065660069L, 3041631479L,
2420952273L, 2306437331L
};
}
我收到以下错误:
错误:编译错误:OR 运算符只能应用于布尔表达式或第 36 行第 18 列的 Integer 或 Long 表达式
这是在这一行:
data = ( data << 8 ) | keytemp[j];
有没有另一种方法来编写这行代码?
谢谢