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

  • <legend id='xzm4S'><style id='xzm4S'><dir id='xzm4S'><q id='xzm4S'></q></dir></style></legend>
    <tfoot id='xzm4S'></tfoot>

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

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

          <bdo id='xzm4S'></bdo><ul id='xzm4S'></ul>
      1. 將十六進制字符串解析為整數會引發 NumberFormat

        Parsing a Hexadecimal String to an Integer throws a NumberFormatException?(將十六進制字符串解析為整數會引發 NumberFormatException?)
        <legend id='1T1Bm'><style id='1T1Bm'><dir id='1T1Bm'><q id='1T1Bm'></q></dir></style></legend>
      2. <small id='1T1Bm'></small><noframes id='1T1Bm'>

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

                  <bdo id='1T1Bm'></bdo><ul id='1T1Bm'></ul>
                  <tfoot id='1T1Bm'></tfoot>
                    <tbody id='1T1Bm'></tbody>
                • 本文介紹了將十六進制字符串解析為整數會引發 NumberFormatException?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以,在 Java 中,您知道如何像這樣聲明整數:

                  So, In Java, you know how you can declare integers like this:

                  int hex = 0x00ff00;
                  

                  我認為您應該能夠逆轉該過程.我有這個代碼:

                  I thought that you should be able to reverse that process. I have this code:

                  Integer.valueOf(primary.getFullHex());
                  

                  其中 primary 是自定義 Color 類的對象.它的構造函數接受一個整數表示不透明度(0-99)和一個十六進制字符串(例如 00ff00).

                  where primary is an object of a custom Color class. It's constructor takes an Integer for opacity (0-99) and a hex String (e.g. 00ff00).

                  這是 getFullHex 方法:

                  public String getFullHex() {
                      return ("0x" + hex);
                  }
                  

                  當我調用此方法時,它會給出我的 NumberFormatException:

                  When I call this method it gives my this NumberFormatException:

                  java.lang.NumberFormatException: For input string: "0xff0000"
                  

                  我不明白發生了什么.誰能解釋一下?

                  I can't understand what's going on. Can someone please explain?

                  推薦答案

                  這會有幫助嗎?

                  Integer.parseInt("00ff00", 16)
                  

                  16 表示您應該將字符串解釋為基于 16 的(十六進制).使用 2 可以解析二進制數,8 代表八進制.10 是默認值,解析十進制數.

                  16 means that you should interpret the string as 16-based (hexadecimal). By using 2 you can parse binary number, 8 stands for octal. 10 is default and parses decimal numbers.

                  在您的情況下, Integer.parseInt(primary.getFullHex(), 16) 將不起作用,因為 0x 前綴由 getFullHex() - 擺脫,你會沒事的.

                  In your case Integer.parseInt(primary.getFullHex(), 16) won't work due to 0x prefix prepended by getFullHex() - get rid of and you'll be fine.

                  這篇關于將十六進制字符串解析為整數會引發 NumberFormatException?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

                      <tbody id='4PRno'></tbody>

                    <small id='4PRno'></small><noframes id='4PRno'>

                      <bdo id='4PRno'></bdo><ul id='4PRno'></ul>
                      <legend id='4PRno'><style id='4PRno'><dir id='4PRno'><q id='4PRno'></q></dir></style></legend>
                        <tfoot id='4PRno'></tfoot>

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

                          • 主站蜘蛛池模板: 黑人精品xxx一区一二区 | 999免费网站 | 欧美一区2区三区4区公司 | 国产福利精品一区 | 亚洲精品中文字幕av | 在线欧美亚洲 | 91免费视频 | 成人精品福利 | 成人国产精品久久久 | 91av在线影院 | 精品国产第一区二区三区 | 操操日| 欧美激情欧美激情在线五月 | 日韩欧美亚洲一区 | 男女羞羞视频大全 | 欧美成人手机视频 | 午夜免费福利影院 | 精品国产青草久久久久福利 | 放个毛片看看 | 日韩欧美综合 | 免费国产视频 | 国产激情精品一区二区三区 | 中文字幕日韩一区 | 美女日批免费视频 | 国产成人免费网站 | 婷婷亚洲综合 | 欧美国产视频一区二区 | 久久精品一区 | 国产一级大片 | 亚洲第一在线 | 久久精品视频一区二区三区 | 伊人伊人伊人 | 欧美成人精品激情在线观看 | 91视视频在线观看入口直接观看 | 欧美在线视频网 | 国产精品久久久乱弄 | 日日夜夜精品视频 | 秋霞a级毛片在线看 | 成人av免费| 国产精品一区二区免费看 | 国产精品中文字幕在线 |