我正在使用operator | 和&但没有得到正确的答案

0 java bit-manipulation operator-keyword

public class num {
    public static void main(String args[]) {
        int i = 5, j = 9, k = 3;
        int w, x;
        w = i | j | k;
        x = i &j & k;
        System.out.println(w);
        System.out.println(x);
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么价值观w = 15x = 1

Duk*_*ing 7

&并且|按位运算符(分别是AND和OR).

5 ->  101
3 ->   11
9 -> 1001
     ----
AND  0001 = 1
OR   1111 = 15
Run Code Online (Sandbox Code Playgroud)