In this training class, a student asked a question that had plagued him for more than half a year. The program code is as follows:
Public class testutf8
{
Public static void main (string [] ARGs) throws exception
{
Byte [] bytes = {(byte) 0xc0, (byte) 0xb1 };
String STR = new string (bytes, "UTF-8 ");
System. Out. println (Str. getbytes ("UTF-8"). Length );
}
}
The output after running the program is as follows:
1
This program willTwoBytes arrays of bytes are converted to strings encoded by UTF-8, and then the result string is converted to a byte array encoded by UTF-8, the length of the printed byte array isI. Why is the length of the byte array converted from two byte arrays reversed to one?
After reading the negative comments of this topic and the previous topic, I wanted to ignore them and let them develop, my principle is "don't talk to people I'm not interested in! If you are bored, you should not hear it !". I will not write any blog because of so many negative comments. I write a blog to promote my learning philosophy and promote my training methods. I will not use some malicious tricks, it's stuck! If a person wants to do something, he can't be afraid of things. He borrowed a friend's words: "In China, there must be ten people doing things in disorder. There must be these troublemakers, we do not want to do anything! ". The reason why I responded was that some of them did not offer good comments, but they were not malicious.
First, rumors are terrible. I was deeply touched by a recent incident: In the book reviews of Sun weiqin, I saw a criticism of Liu Yang, saying that all the hibernate proficient written by Liu Yang copied sun weiqin, even the examples are the same. I believed it was true. I had a chat with Liu Yang before, but I did not read the books he wrote. After seeing the book review, I really had a bad impression on Liu Yang in my mind. Later I had the honor to read Liu Yang's book about hibernate. After reading it, I felt like, liu Yang's book is not suitable for beginners to read, and his knowledge is not thorough. Isn't it a good book! However, from this book, we can see that Liu Yang has a lot of his own things and has a good technical skills. He just didn't give them a thorough explanation. I only read the first six chapters, no trace of Sun weiqin was found. The knowledge content written by Liu Yang is irrelevant to the knowledge content written by Sun weiqin. However, like most people, I believe that I will not be confused. I am confused by this rumor on the Internet and mistakenly doubt Liu Yang's technology and character. It seems that many things cannot be easily believed if they have not experienced them.
Secondly, I have never thought that I am a technical expert. I have more people than me. Some people are really good. Some people are fake cows. I know this well! I will not go crazy to compete with every technical expert. I have written these articles because I have some bad feelings in my heart. Most of the teachers in the training center I contact have no idea about these basic knowledge, some people sneer at me and use it to slander me. I am very happy to see that many people have a strong reaction to my articles and actively debate these articles. What I want is this effect. Let the so-called "high-end training" teachers look at it, not only do I have a research on these basic knowledge, but there are still many people who have research on this. Let them compare them and see what they are looking? However, I have gained some support for teaching these basic knowledge. For example, I have taught several courses in a training center before. students with poor foundations have complained to me, the persons in charge of this training center did not seldom speak ill of me behind the scenes. Some of my fans were not familiar with me and did not learn from them. It was a bit strange. I was very interested in the class, I am willing to listen to my lectures. Some say that I am really an excellent teacher, some say that I am his idol, and some say that I will not learn after I have listened to two lessons from other teachers, I simply went out to work. When I started the course this time, I quit my job to attend this training class. Some bosses are very interesting. Once you have cooperated with him, you will not cooperate in the future. No matter whether you have harmed him or not, as long as you no longer serve him, he will treat you as an enemy. However, such a boss seems to be able to do nothing.