package org.java.io;
/***递归剖析*/
public class ResursionTest {
public static void main(String[] args) {
toBin(6);
}
public static void Sop(Object o){
System.out.println(o);
}
/***需求分析求一个书的二进制代码*/
public static void numberToBin(int number){
//原始方法求二进制代码
while(number>0){
number=number/2;
Sop(number%2);
}
}
/**使用递归求值*/
public static void toBin(int num){
if(num>0)
toBin(num/2);
Sop(num%2);
}
}
/***递归剖析*/
public class ResursionTest {
public static void main(String[] args) {
toBin(6);
}
public static void Sop(Object o){
System.out.println(o);
}
/***需求分析求一个书的二进制代码*/
public static void numberToBin(int number){
//原始方法求二进制代码
while(number>0){
number=number/2;
Sop(number%2);
}
}
/**使用递归求值*/
public static void toBin(int num){
if(num>0)
toBin(num/2);
Sop(num%2);
}
}