进制转换,打印99乘法表

时间:2022-09-04 00:46:06
	
public void print99Table(){		for(int i=1;i<=9;i++){			for(int j=1;j<=i;j++){				System.out.print(j+"*"+i+"="+(j*i)+"\t");			}			System.out.println();		}	}


 
	/*
 
	 * in  输入的数	 * inNum 输入的数的进制	 * outNum  输出的数的进制	 */
public static String conversion(String in,int inNum,int outNum){int tmp=0;if(inNum!=10){int len=in.length();int result=0;for(int i=0;i<len;i++){int bitNum=Integer.parseInt(in.charAt(len-1-i)+"");tmp+=(int) (bitNum*Math.pow(inNum, i));}}else{tmp=Integer.parseInt(in);}if(outNum==10){return tmp+"";}if(outNum==16){return Integer.toOctalString(tmp);}String out="";if(outNum<10){while(tmp!=0){out=tmp%outNum+out;tmp/=outNum;}}return out;}