Get the App
SLTechnology News&Howtos  ›  Development  › 

How does Java Integer get the first and last bits and intercept them?

Shulou Source: shulou.com Published: 2022-06-01 21:50:50 09月19日 Update

The content of this article mainly focuses on how Java Integer gets the first and last place and intercepts it. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!

Integer gets the first and last bits and intercepts the scene

Get 5, 10, 15, 25, 30; enter the judgment if the Mantissa is 5.

Public static void main (String [] args) {String str = "data test, custom field"; / / determine whether the first character is "if" (str.startsWith ("number")) {str = str.substring (1) } / / determine whether the last character is "segment" if (str.endsWith ("paragraph")) {str = str.substring (0 System.out.println str.length ()-1);} System.out.println (str);} ingenious method of calculating the number of Integer digits

Today, I found it interesting to see the java source code.

Final static int [] sizeTable = {9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 99999999, Integer.MAX_VALUE}; / / Requires positive x static int stringSize (int x) {for (int iTuno;; iTunes +) if (x

Tags: Content characters articles ingenious interesting digits interests scenes fields Mantissa data novices methods easy to understand more friends organization source code knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Docker NVidia Linux OPPO Reno