3
工作我如何解釋這個代碼類Java卡初學者的一種方式,他們將完全理解它:如何二元運算符的說明「和」 Java智能卡
private void getBalance(APDU apdu) {
byte[] buffer = apdu.getBuffer();
// inform system that the applet has finished
// processing the command and the system should
// now prepare to construct a response APDU
// which contains data field
short le = apdu.setOutgoing();
if (le < 2) {
ISOException.throwIt((byte) 0x6A86);
}
// informs the CAD the actual number of bytes
// returned
apdu.setOutgoingLength((byte) 2);
// move the balance data into the APDU buffer
// starting at the offset 0
buffer[0] = (byte) (balance >> 8);
buffer[1] = (byte) (balance & 0xFF);//How do i explain what happens here
// send the 2-byte balance at the offset
// 0 in the apdu buffer
apdu.sendBytes((short) 0, (short) 2);
}
我不認爲你甚至需要'&0xFF'在這裏。 – user2357112
@ user2357112:確實不是。 –
'(byte)0x6A86' - 到底是什麼?這看起來很像一個錯誤。幻數的一半就被扔掉了。 – user2357112