String(정수) to Int

- int num = Integer.parseInt(str);

- int num = Integer.valueOf(str);

 

Int to String

- String str = Integer.toString(i);

- String str = String.valueOf(i);

 

Char to Int

int num = (int)(ch-'0'); // 0은 48

 

Int to Char

- char ch = (char)(num+'0');

 

String to char

- String str = "A";

- char[] ch = str.toCharArray();

- ch[0]; // 'A'

 

Double to String

- String str = Double.toString(db);

 

String to Double

- double db = Double.valueOf(str).doubleValue();

 

long to String

- String str = Long.toString(l);

 

String to long 

- long l = Long.valueOf(str).longValue();

- long l = Long.parseLong(str);

 

float to String

- String str = Float.toString(f);

 

String to float

- float f = Float.valueOf(str).floatValue();

 

ASCII Code to String

- String str = new Character((char)num).toString();

 

String to ASCII Code

- int num = (int)ch;

 

10진수 -> 2진수

- String binaryStr = Integer.toBinaryString(num);

 

+ Recent posts