Comment detail

2進数の記述 (Nested Flatten)

2進数のリテラル表記はないので

1
Integer.parseInt("01101001", 2);

基準の最後に「定数に変換される」がありますので、一応、定数として宣言したほうが題意にあっているのではないかと考えました。

1
2
3
4
5
6
7
public class Sample {
    public static final int B01101001 = Integer.parseInt("01101001", 2);

    public static void main(String[] args) {
        System.out.println(B01101001);
    }
}

Index

Feed

Other

Link

Pathtraq

loading...