package com.anteoy.dataStructuresAndAlgorithm.javav2;

/**
 * Created by zhoudazhuang on 17-2-16.
 * Description:
 */
public class PrintString {
    public static void main(String [] args)
    {
        printStrs(123456789);
        printByte(123456);
        printString(123456);
    }
    /**
     * 逐个字符打印所给整数
     * @param n 这里系统标准输出流每次都只打印一个字符
     */
    private static void printStrs(int n) {
        //递归临界条件
        if(n>=10){
            //前递归顺序执行
            printStrs(n/10);
        }
        //后递归执行（反前递归顺序）
        System.out.println(n%10);
    }

    private static void printByte(int n){
        //转为String
        String s = String.valueOf(n);
        byte[] bytes = s.getBytes();
        for (byte b: bytes) {
            System.out.println(String.valueOf(b));
        }
    }

    private static void printString(int n){
        //转为String
        String s = String.valueOf(n);
        //转为char[]
        char[] chars = new char[s.length()];
        s.getChars(0,s.length(),chars,0);
        //for each输出
        for (char b: chars) {
            System.out.println(String.valueOf(b));
        }
    }
}

@@ -784,24 +784,61 @@
     %7D%0A    %7D%0A
+    //add private%E5%8F%AA%E8%83%BD%E5%9C%A8%E7%B1%BB%E5%86%85%E9%83%A8%E4%BD%BF%E7%94%A8%EF%BC%88%E5%A6%82new %E5%85%B6%E4%BB%96%E9%83%BD%E4%B8%8D%E8%A1%8C%EF%BC%89
 %0A    private

add private des