• <tfoot id='9Efjv'></tfoot>
    <i id='9Efjv'><tr id='9Efjv'><dt id='9Efjv'><q id='9Efjv'><span id='9Efjv'><b id='9Efjv'><form id='9Efjv'><ins id='9Efjv'></ins><ul id='9Efjv'></ul><sub id='9Efjv'></sub></form><legend id='9Efjv'></legend><bdo id='9Efjv'><pre id='9Efjv'><center id='9Efjv'></center></pre></bdo></b><th id='9Efjv'></th></span></q></dt></tr></i><div id='9Efjv'><tfoot id='9Efjv'></tfoot><dl id='9Efjv'><fieldset id='9Efjv'></fieldset></dl></div>

    <small id='9Efjv'></small><noframes id='9Efjv'>

    • <bdo id='9Efjv'></bdo><ul id='9Efjv'></ul>

        <legend id='9Efjv'><style id='9Efjv'><dir id='9Efjv'><q id='9Efjv'></q></dir></style></legend>

        为什么 Java 能够将 0xff000000 存储为 int?

        时间:2023-10-02
            <tbody id='DA6t0'></tbody>
        • <legend id='DA6t0'><style id='DA6t0'><dir id='DA6t0'><q id='DA6t0'></q></dir></style></legend>
          • <bdo id='DA6t0'></bdo><ul id='DA6t0'></ul>
              <tfoot id='DA6t0'></tfoot>
            • <i id='DA6t0'><tr id='DA6t0'><dt id='DA6t0'><q id='DA6t0'><span id='DA6t0'><b id='DA6t0'><form id='DA6t0'><ins id='DA6t0'></ins><ul id='DA6t0'></ul><sub id='DA6t0'></sub></form><legend id='DA6t0'></legend><bdo id='DA6t0'><pre id='DA6t0'><center id='DA6t0'></center></pre></bdo></b><th id='DA6t0'></th></span></q></dt></tr></i><div id='DA6t0'><tfoot id='DA6t0'></tfoot><dl id='DA6t0'><fieldset id='DA6t0'></fieldset></dl></div>

              1. <small id='DA6t0'></small><noframes id='DA6t0'>

                  本文介绍了为什么 Java 能够将 0xff000000 存储为 int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  Java 中整数的最大值是 2147483647,因为 Java 整数是有符号的,对吧?

                  An integer's max value in Java is 2147483647, since Java integers are signed, right?

                  0xff000000 的数值为 4278190080.

                  0xff000000 has a numeric value of 4278190080.

                  但我看到这样的 Java 代码:

                  Yet I see Java code like this:

                  int ALPHA_MASK = 0xff000000;
                  

                  谁能赐教?

                  推荐答案

                  高位是符号位.设置它表示一个负数:-16777216.

                  The high bit is a sign bit. Setting it denotes a negative number: -16777216.

                  与大多数语言一样,Java 以 2 的补码 形式存储带符号的数字.在这种情况下,从 0x7F000000 或 2130706432 中减去 231 或 2147483648,得到 -16777216.

                  Java, like most languages, stores signed numbers in 2's complement form. In this case, subtracting 231, or 2147483648 from 0x7F000000, or 2130706432, yields -16777216.

                  这篇关于为什么 Java 能够将 0xff000000 存储为 int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:意外结果导致长/整数除法 下一篇:java的行为不一致==

                  相关文章

                  最新文章

                1. <legend id='uPWX7'><style id='uPWX7'><dir id='uPWX7'><q id='uPWX7'></q></dir></style></legend>

                    <tfoot id='uPWX7'></tfoot>

                    <small id='uPWX7'></small><noframes id='uPWX7'>

                    • <bdo id='uPWX7'></bdo><ul id='uPWX7'></ul>

                  1. <i id='uPWX7'><tr id='uPWX7'><dt id='uPWX7'><q id='uPWX7'><span id='uPWX7'><b id='uPWX7'><form id='uPWX7'><ins id='uPWX7'></ins><ul id='uPWX7'></ul><sub id='uPWX7'></sub></form><legend id='uPWX7'></legend><bdo id='uPWX7'><pre id='uPWX7'><center id='uPWX7'></center></pre></bdo></b><th id='uPWX7'></th></span></q></dt></tr></i><div id='uPWX7'><tfoot id='uPWX7'></tfoot><dl id='uPWX7'><fieldset id='uPWX7'></fieldset></dl></div>