Conversion between Java int type and character, kanji

Source: Internet
Author: User

/**
* Streams in Java are mainly divided into byte stream and character stream
* Another angle analysis can be divided into input stream and output stream
* Input and output are a relative concept relative to the memory size of the JVM virtual machine
* From another point of view Java or other software developed in Java is just a tool.
* You can go deep in several ways, one is to make use of good tools, one is a retrofit tool, the other is a manufacturing tool
*/
try {
BufferedReader bufferedreader=new BufferedReader (New FileReader ("d:\\es Note \\ES Command"));
String readLine = null;
while ((Readline=bufferedreader.readline ())!=null) {
System.out.println (ReadLine);
}
} catch (FileNotFoundException e) {
E.printstacktrace ();
} catch (IOException e) {
E.printstacktrace ();
}
try {
Bufferedinputstream bufferedinputstream=new Bufferedinputstream (New FileInputStream ("d:\\es Note \\ES Command"));
int read = 0;
while ((read = Bufferedinputstream.read ())!=-1) {

System.out.print ((char) read);
}
} catch (Exception e) {
E.printstacktrace ();
}
/**
* Seemingly char can be converted between characters, Chinese characters and numbers, and the function of a personal understanding of char is the process of finding an ASCII code table.
*/
try {
String s= "22307 35806 24555 20048";//ascii code
string[] split = S.split ("");
for (String string:split) {
System.out.println ((char) integer.parseint (string));
}
} catch (Exception e) {
}

try {
String s= "Hello China";//ascii yards
string[] split = S.split ("");
for (String string:split) {
System.out.print ((int) String.charat (0) + "");
}
} catch (Exception e) {
}

Conversion between Java int type and character, kanji

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.