java int_to_char_conversion

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java int_to_char_conversion相关的知识,希望对你有一定的参考价值。

public class pifagorTable {

	public static void main(String[] args) {
		 	int x=0;
		    int y=0;
		    final int horisLimit = 10;
		    final int vertLimit  = 10;
		    System.out.println("Pifagor's table" );
		    System.out.print("\t");
		    for (y=1; y<vertLimit; y++){
		    	System.out.print(y+ "\t");
		    }
		    printNewline();
		    for (y=1; y<vertLimit; y++){
		        System.out.print("*********");
		    }
		    printNewline();	    
		    for (y=1; y<vertLimit; y++){
		    	System.out.print(y+"|" + "\t");
		        for(x=1; x<horisLimit; x++){
		            System.out.print(x * y + "\t");
		        }
		        printNewline();
		    }

	}
}

public class helperFunctions {
	public static void printNewline(){
		  System.out.println("");
	}
}

public class charsStudy2 {
	public static void main(String[] args) {
		int i, j;
		int iVal, iValDigits;
		char iChar;
		String myTabSpace;
		for(i = 0; i<16; i++){
			for(j = 0; j < 6; j++){
				iVal = 65+i+j*16;
				iValDigits = String.valueOf(iVal).length();
				switch (iValDigits) {
					case 1: myTabSpace = " -> ";  break;
					case 2: myTabSpace = "-> ";  break;
					case 3: myTabSpace = "->"; break;
					default: myTabSpace = "->"; break;
				}
				System.out.print(iVal + myTabSpace);
				iChar = (char)(iVal);
				System.out.print(iChar);
				System.out.print(" ");
			}
			helperFunctions.printNewline();
		}
	}
}


以上是关于java int_to_char_conversion的主要内容,如果未能解决你的问题,请参考以下文章

Java 布尔运算

java [Java] Java常用代码#java

Java - 35 Java 实例

Java While 循环

Java 字符串

Java If ... Else