In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "case Analysis of byte Storage problems in String". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Coding of value
Let's still use the example in String:
String s = new String ("java technology base")
In jdk1.8 and before, values in String were stored in char value []. In jdk11, the storage is replaced by byte [], as shown in the following figure:
In the debug breakpoint, we can see that the "java technology stronghold" is stored as:
Some friends already have doubts about why they have become these numbers. In fact, these are still char, just a change of form.
As shown in the following figure, we separately simulated the storage of the word "camp".
As you can see from the picture above, the char is actually split into two parts. We know that a single char is stored as a 2-byte, 16-bit unicode. For the battalion char, the decimal unicode is: '33829'. The conversion to binary is: 1000010000100101
We split the binary string into two parts, the first part is the low 8-bit '00100101', the other is the high 8-bit '10000100', and then convert the binary to decimal, which is 37 and-124 we see.
This is the end of the content of "String's case Analysis of byte Storage problems". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.