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

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

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

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

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

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

        如何獲得整數的單獨數字?

        How to get the separate digits of an int number?(如何獲得整數的單獨數字?)

              <legend id='eGyVH'><style id='eGyVH'><dir id='eGyVH'><q id='eGyVH'></q></dir></style></legend>
                • <bdo id='eGyVH'></bdo><ul id='eGyVH'></ul>
                    <tbody id='eGyVH'></tbody>

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

                  <tfoot id='eGyVH'></tfoot>

                  <i id='eGyVH'><tr id='eGyVH'><dt id='eGyVH'><q id='eGyVH'><span id='eGyVH'><b id='eGyVH'><form id='eGyVH'><ins id='eGyVH'></ins><ul id='eGyVH'></ul><sub id='eGyVH'></sub></form><legend id='eGyVH'></legend><bdo id='eGyVH'><pre id='eGyVH'><center id='eGyVH'></center></pre></bdo></b><th id='eGyVH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eGyVH'><tfoot id='eGyVH'></tfoot><dl id='eGyVH'><fieldset id='eGyVH'></fieldset></dl></div>
                • 本文介紹了如何獲得整數的單獨數字?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有 1100、1002、1022 等數字.我想要單獨的數字,例如對于第一個數字 1100,我想要 1、1、0、0.

                  I have numbers like 1100, 1002, 1022 etc. I would like to have the individual digits, for example for the first number 1100 I want to have 1, 1, 0, 0.

                  如何在 Java 中獲得它?

                  How can I get it in Java?

                  推薦答案

                  為此,您將使用 % (mod) 運算符.

                  To do this, you will use the % (mod) operator.

                  int number; // = some int
                  
                  while (number > 0) {
                      print( number % 10);
                      number = number / 10;
                  }
                  

                  mod 運算符將為您提供對數字進行 int 除法的余數.

                  The mod operator will give you the remainder of doing int division on a number.

                  所以,

                  10012 % 10 = 2
                  

                  因為:

                  10012 / 10 = 1001, remainder 2
                  

                  注意: 正如 Paul 所說,這會以相反的順序為您提供數字.您需要將它們壓入堆棧并以相反的順序將它們彈出.

                  Note: As Paul noted, this will give you the numbers in reverse order. You will need to push them onto a stack and pop them off in reverse order.

                  按正確順序打印數字的代碼:

                  Code to print the numbers in the correct order:

                  int number; // = and int
                  LinkedList<Integer> stack = new LinkedList<Integer>();
                  while (number > 0) {
                      stack.push( number % 10 );
                      number = number / 10;
                  }
                  
                  while (!stack.isEmpty()) {
                      print(stack.pop());
                  }
                  

                  這篇關于如何獲得整數的單獨數字?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
                    <bdo id='PUFeC'></bdo><ul id='PUFeC'></ul>

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

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

                          <tfoot id='PUFeC'></tfoot>

                            <legend id='PUFeC'><style id='PUFeC'><dir id='PUFeC'><q id='PUFeC'></q></dir></style></legend>
                            主站蜘蛛池模板: 久久久久国产一区二区三区四区 | 日韩在线视频一区二区三区 | 亚洲欧美一区二区三区国产精品 | 91国产在线播放 | 美国十次成人欧美色导视频 | 中文字幕视频一区 | 91欧美激情一区二区三区成人 | 一区二区三区四区免费在线观看 | 成人免费视频网 | av大全在线 | 久久草在线视频 | 日韩欧美三区 | 欧美日韩中文字幕 | 成人免费视频网站在线看 | 最近免费日本视频在线 | 99福利视频导航 | 古典武侠第一页久久777 | a在线免费观看视频 | 精品欧美色视频网站在线观看 | www.99热 | 日本精品999 | 精品国产欧美日韩不卡在线观看 | 国产一区91精品张津瑜 | 伊人伊人伊人 | 一区二区三区四区日韩 | 91毛片在线看 | 91视频在线看 | 国产成人91| 91成人免费观看 | 欧美日韩精品在线免费观看 | 性色网站 | 中文二区 | a级片在线观看 | 国产精品日韩一区 | 欧美激情在线精品一区二区三区 | 精品亚洲永久免费精品 | 国产精品精品视频一区二区三区 | 中文字幕影院 | 91久久精品国产91久久性色tv | 国产精品福利在线观看 | 精品一区精品二区 |