ここに小さなプログラムがあります
public class example {
private byte b1;
public byte getB1() {
return b1;
}
public void setB1(byte b1) {
this.b1 = b1;
}
public static void main(String[] args) {
final byte a = 01;
example e = new example();
e.setB1(a);
System.out.println(e.getB1());
}
}
このプログラムは値を 01 ではなく 1 として返しますが、01 (設定済み) であると予想しています。 01 が設定されている場合、バイトから 01 出力を取得する方法。