久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='iQCm2'></bdo><ul id='iQCm2'></ul>

    <legend id='iQCm2'><style id='iQCm2'><dir id='iQCm2'><q id='iQCm2'></q></dir></style></legend>

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

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

        <tfoot id='iQCm2'></tfoot>

        Java中的整數如何轉換為字節?

        How are integers cast to bytes in Java?(Java中的整數如何轉換為字節?)
        <legend id='nkHSw'><style id='nkHSw'><dir id='nkHSw'><q id='nkHSw'></q></dir></style></legend>

          <i id='nkHSw'><tr id='nkHSw'><dt id='nkHSw'><q id='nkHSw'><span id='nkHSw'><b id='nkHSw'><form id='nkHSw'><ins id='nkHSw'></ins><ul id='nkHSw'></ul><sub id='nkHSw'></sub></form><legend id='nkHSw'></legend><bdo id='nkHSw'><pre id='nkHSw'><center id='nkHSw'></center></pre></bdo></b><th id='nkHSw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nkHSw'><tfoot id='nkHSw'></tfoot><dl id='nkHSw'><fieldset id='nkHSw'></fieldset></dl></div>

          • <small id='nkHSw'></small><noframes id='nkHSw'>

                  <tbody id='nkHSw'></tbody>
                <tfoot id='nkHSw'></tfoot>
                  <bdo id='nkHSw'></bdo><ul id='nkHSw'></ul>
                • 本文介紹了Java中的整數如何轉換為字節?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我知道 Java 不允許無符號類型,所以我想知道它是如何將整數轉換為字節的.假設我有一個值為 255 的整數 a 并將整數轉換為一個字節.該值是否以字節 11111111 表示?換句話說,該值是更多地被視為一個有符號的 8 位整數,還是直接復制整數的最后 8 位?

                  I know Java doesn't allow unsigned types, so I was wondering how it casts an integer to a byte. Say I have an integer a with a value of 255 and I cast the integer to a byte. Is the value represented in the byte 11111111? In other words, is the value treated more as a signed 8 bit integer, or does it just directly copy the last 8 bits of the integer?

                  推薦答案

                  這叫做 縮小基元轉換.根據規范:

                  有符號整數到整數類型的窄化轉換T 只丟棄除n 個最低位之外的所有位,其中n 是用于表示類型 T 的位數.除了可能丟失有關數值大小的信息外,這還可能導致結果值的符號與輸入值的符號不同.

                  A narrowing conversion of a signed integer to an integral type T simply discards all but the n lowest order bits, where n is the number of bits used to represent type T. In addition to a possible loss of information about the magnitude of the numeric value, this may cause the sign of the resulting value to differ from the sign of the input value.

                  所以這是您列出的第二個選項(直接復制最后 8 位).

                  So it's the second option you listed (directly copying the last 8 bits).

                  我不確定你是否知道有符號整數值是如何表示的,所以為了安全起見,我會指出字節值 1111 1111 在 二的補碼 系統(Java 使用).

                  I am unsure from your question whether or not you are aware of how signed integral values are represented, so just to be safe I'll point out that the byte value 1111 1111 is equal to -1 in the two's complement system (which Java uses).

                  這篇關于Java中的整數如何轉換為字節?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    1. <legend id='PRs6b'><style id='PRs6b'><dir id='PRs6b'><q id='PRs6b'></q></dir></style></legend>
                      • <bdo id='PRs6b'></bdo><ul id='PRs6b'></ul>
                          <tbody id='PRs6b'></tbody>
                        <tfoot id='PRs6b'></tfoot>

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

                        <i id='PRs6b'><tr id='PRs6b'><dt id='PRs6b'><q id='PRs6b'><span id='PRs6b'><b id='PRs6b'><form id='PRs6b'><ins id='PRs6b'></ins><ul id='PRs6b'></ul><sub id='PRs6b'></sub></form><legend id='PRs6b'></legend><bdo id='PRs6b'><pre id='PRs6b'><center id='PRs6b'></center></pre></bdo></b><th id='PRs6b'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PRs6b'><tfoot id='PRs6b'></tfoot><dl id='PRs6b'><fieldset id='PRs6b'></fieldset></dl></div>

                            主站蜘蛛池模板: 久久大 | 精品久久久一区 | 久久九九网站 | 欧美日韩精品一区二区 | 亚洲欧洲一区二区 | 成人免费视频观看视频 | 免费国产成人av | 在线欧美一区 | 日日爱夜夜操 | 欧美视频成人 | 亚洲欧美一区二区三区情侣bbw | 99色综合 | 久久久精品影院 | 国产日韩欧美一区二区在线播放 | 日韩欧美一区在线 | 亚洲在线电影 | 精品欧美一区二区三区精品久久 | 一区二区在线免费观看 | 亚洲美女网站 | 国产精品美女在线观看 | 久久91av| 中文字幕在线第二页 | 色视频网站在线观看 | 日韩一区二区三区在线视频 | jizz在线免费观看 | 色成人免费网站 | 亚洲区一区二 | 偷牌自拍| 国产高清视频一区 | 精品二区 | 99精品福利视频 | 欧美高清视频一区 | 欧美国产日韩成人 | 日韩av成人 | 亚洲九九 | 99精品欧美一区二区三区综合在线 | 91欧美激情一区二区三区成人 | 免费观看一级特黄欧美大片 | 一区二区在线免费播放 | 日韩日韩日韩日韩日韩日韩日韩 | 精品国产精品国产偷麻豆 |