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

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

    1. <tfoot id='Foivn'></tfoot>

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

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

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

        Java - 格式化數字以僅打印小數部分

        Java - Format number to print decimal portion only(Java - 格式化數字以僅打印小數部分)
          <legend id='cn2EF'><style id='cn2EF'><dir id='cn2EF'><q id='cn2EF'></q></dir></style></legend>

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

              <tbody id='cn2EF'></tbody>

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

              • <tfoot id='cn2EF'></tfoot>

                  本文介紹了Java - 格式化數字以僅打印小數部分的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  Is there a simple way in Java to format a decimal, float, double, etc to ONLY print the decimal portion of the number? I do not need the integer portion, even/especially if it is zero! I am currently using the String.indexOf(".") method combined with the String.substring() method to pick off the portion of the number on the right side of the decimal. Is there a cleaner way to do this? Couldn't find anything in the DecimalFormat class or the printf method. Both always return a zero before the decimal place.

                  解決方案

                  You can remove the integer part of the value by casting the double to a long. You can then subtract this from the original value to be left with only the fractional value:

                  double val = 3.5;
                  long intPartVal= (long) val;
                  double fracPartVal = val - intPartVal;
                  System.out.println(fracPartVal);
                  

                  And if you want to get rid of the leading zero you can do this:

                  System.out.println(("" + fracPartVal).substring(1));
                  

                  這篇關于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?)
                  <tfoot id='DzHtd'></tfoot>
                    <bdo id='DzHtd'></bdo><ul id='DzHtd'></ul>

                        <tbody id='DzHtd'></tbody>

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

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

                            主站蜘蛛池模板: 国产精品视频网 | 精品久久一区 | 国产日韩欧美精品 | 在线午夜| 中国一级特黄真人毛片免费观看 | av一级久久 | 国产一区在线免费观看 | 欧美精品一区二区三区蜜桃视频 | 红桃视频一区二区三区免费 | 日韩资源| 少妇性l交大片免费一 | 男女网站视频 | 久久com| 久久99精品久久久久久国产越南 | 婷婷福利视频导航 | 日韩一区二区av | 97免费视频在线观看 | 国产精品久久久久久久午夜片 | 福利网站导航 | 国产不卡一区 | av免费在线观看网站 | 99re视频在线免费观看 | 久久91av | av国产精品 | 国产1区在线 | 久久av一区二区 | 成年人在线视频 | 国产精品久久久久久久久久久新郎 | 国产高清精品在线 | 国产乱码精品一品二品 | 99免费 | 欧美男人的天堂 | 黄视频国产 | 91一区二区三区 | 久久精品国产亚洲 | 日韩欧美不卡 | 久久精品色欧美aⅴ一区二区 | 久久国产精品免费视频 | 在线观看精品视频网站 | 黄频免费| 亚洲一区|