• Java Int类型与字符,汉字之间的转换



    Java 中的流主要是分为字节流和字符流
    再一个角度分析的话可以分为输入流和输出流
    输入和输出是一个相对的概念 相对的分别是jvm虚拟机的内存大小
    从另一个角度讲Java或者用Java开发的其他软件只是一个工具而已
    你可以从几个角度进行深入,一个是利用好工具,一个是改造工具,一个是制造工具

    try {
    BufferedReader bufferedReader=new BufferedReader(new FileReader(new File("D:\ES笔记\ES命令")));
    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笔记\ES命令"));
    int read =0;
    while ((read = bufferedInputStream.read())!=-1) {
    
    //System.out.print((char)read); 
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    /**
    * 貌似char可以在字符,汉字与数字之间进行转换,个人理解的char的作用就是一个查找ascii码表的过程
    */
    try {
    String s="22307 35806 24555 20048";//ASCII码
    String[] split = s.split(" ");
    for (String string : split) {
    //System.out.println((char)Integer.parseInt(string));
    }
    } catch (Exception e) {
    
    e.printStackTrace();
    
    }
    
    try {
    String s="你 好 中 国";//ASCII码
    String[] split = s.split(" ");
    for (String string : split) {
    System.out.print((int)string.charAt(0)+" ");
    }
    } catch (Exception e) {
    
    e.printStackTrace();
    }
  • 相关阅读:
    iOS 7用户界面过渡指南
    断言
    UIView的任意圆角
    ios与js交互获取webview元素和赋值
    JSONModel解析Dictionary To Model /JSON To Model
    Mac测试模拟慢网速
    MySQL批量调整数据表里的日期
    博客园查询自己网站二级目录被百度收录的情况
    windows文件夹里批量更新文件后缀
    git 学习
  • 原文地址:https://www.cnblogs.com/suzhenxiang/p/5697659.html
Copyright © 2020-2023  润新知