delphi里很简单,java里能不能象这样写: var l: Word; w: PWord; i: Integer; begin l := Length(arData); if l >= SizeOf(l) then begin w := @arData[1]; for i := 1 to (l div SizeOf(l)) do begin w^ := w^ xor l; Inc(w); end; end; end;
DataInputStream 有一个 readShort() 方法,每次读取2个字节或者你用 short s = is.readByte(); s += is.readByte()<<8;也可以
支持,可以试着使用DataInputStream
如何让一个字节流数组每两字节与一个整数异或 比如:String s = "abcd测试ssd"; byte[] bytes = s.getByte(); int n = 88; 如何每两字节与一个整数异或
字节流 按2字节取出或者字节流分段遍历
然后与int 异或字符流是输入的数据16个bit作为一个处理单位,16bit为Unicode。
int,java里面一个int就是32位http://topic.csdn.net/t/20041101/15/3510696.html
var
l: Word;
w: PWord;
i: Integer;
begin
l := Length(arData);
if l >= SizeOf(l) then
begin
w := @arData[1];
for i := 1 to (l div SizeOf(l)) do
begin
w^ := w^ xor l;
Inc(w);
end;
end;
end;
short s = is.readByte();
s += is.readByte()<<8;也可以
比如:String s = "abcd测试ssd";
byte[] bytes = s.getByte();
int n = 88;
如何每两字节与一个整数异或