privatestaticvoid test(int nc, int ne) throws Exception {
System.out.println("nc = " + nc + ", ne = " + ne); byte[] data = newbyte[nc];
random.nextBytes(data);
CommandAPDU apdu = new CommandAPDU((byte)0, (byte)0, (byte)0, (byte)0, data, ne); //System.out.println(apdu); if (apdu.getNc() != nc) { thrownew Exception("dataLength does not match");
} if (Arrays.equals(data, apdu.getData()) == false) { thrownew Exception("data does not match");
} if (apdu.getNe() != ne) { thrownew Exception("ne does not match");
} byte[] apduBytes = apdu.getBytes();
CommandAPDU apdu2 = new CommandAPDU(apduBytes); //System.out.println(apdu2); if (Arrays.equals(apduBytes, apdu2.getBytes()) == false) { thrownew Exception("apduBytes do not match");
} if (apdu2.getNc() != nc) { thrownew Exception("dataLength does not match");
} if (Arrays.equals(data, apdu2.getData()) == false) { thrownew Exception("data does not match");
} if (apdu2.getNe() != ne) { thrownew Exception("ne does not match");
}
}
publicstaticvoid main(String[] args) throws Exception { int[] t = {0, 42, 0x81, 255, 256, 4242, 0x8181, 65535, 65536}; for (int nc : t) { if (nc == 65536) { continue;
} for (int ne : t) {
test(nc, ne);
}
}
System.out.println("OK");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.