It is my Computer Notes. Using Guide : object-key or object-key-key e.g. Step 1 Blog Search : [mysql-run] and then Step 2 ctrl+F [mysql-run] {bookMark me : Ctrl+D}
2013年9月27日 星期五
java-hex java-binary
<int to Binary / Hex / Octal>
public class DataConversion{
public static void main(String[] args) {
System.out.println("Data types conversion example!");
int in = 50;
System.out.println("Integer: " + in);
//integer to binary
String by = Integer.toBinaryString(in);
System.out.println("Byte: " + by);
//integer to hexadecimal
String hex = Integer.toHexString(in);
System.out.println("Hexa decimal: " + hex);
//integer to octal
String oct = Integer.toOctalString(in);
System.out.println("Octal: " + oct);
}
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言