This question already has answers here: What does << mean in Java?                                                                    (7个答案)                                                                                        5年前关闭。                                我正在使用Java进行作业,我们的讲师为我们提供了示例代码。我无法理解某些代码,所以有人可以解释吗? private long magic; private int minor; magic = file.readUnsignedShort() << 16 | file.readUnsignedShort(); mnior = file.readUnsignedShort();我不明白为什么他要对两个人都使用“ readUnsignedShort”,为什么要添加“ (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 一个short使用16位,一个int使用32位,一个long使用64位。鉴于此,Java中没有无符号的值,因此,如果最高有效位为1,则表示该值为负。拆分您拥有的代码:file.readUnsignedShort() << 16 | file.readUnsignedShort(); xxxx0000 | 0000YYYY = xxxxYYYY (adsbygoogle = window.adsbygoogle || []).push({});
10-08 00:23