블로그 이미지
GUCCI

카테고리

전체보기 (111)
여행 (1)
기기 (2)
쇼핑 (0)
게임 (0)
etc. (6)
취업이야기 (0)
업무일지 (5)
리눅스 (38)
웹프로그래밍 (2)
네트워크 (4)
JAVA (17)
Android (0)
IOS (2)
LUA (8)
C/C++ (1)
Objective C (2)
SERVER (2)
그누보드4 (1)
MSSQL (2)
Programming (1)
자바스크립트 (4)
HTML/CSS (1)
LGNAS (0)
Total
Today
Yesterday

'형변환'에 해당되는 글 1건

  1. 2011.04.06 java 형변환 모음 1

java 형변환 모음

JAVA / 2011. 4. 6. 13:33
[TextView to Double]
TextView  xDoubleA = Double.parseDouble(xViewA.getText());

** xViewA 값은 무조건 숫자형식이여야함. 아닌경우 Exception이 발생.

[int to String]
String str = Integer.toString(i);String str = "" + i;

[String to Int]
int i = Integer.parseInt(str);int i = Integer.valueOf(str).intValue();

[Double to String]
String str = Double.toString(d);

[Long to String]
String str = Long.toString(l);

[Float to String]
String str = Float.toString(f);

[String to Double]
double d = Double.valueOf(str).doubleValue();

[String to Long]

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

[String to Float]
float f = Float.valueOf(str).floatValue();

[Decimal to Binary]

String binstr = Integer.toBinaryString(i);

[Decimal to Hexadecimal]
String hexstr = Integer.toString(i, 16);String hexstr = Integer.toHexString(i);Integer.toHexString( 0x10000 | i).substring(1).toUpperCase());
hexadecimal(String) to int
int i = Integer.valueOf("B8DA3", 16).intValue();int i = Integer.parseInt("B8DA3", 16);

[ASCII Code to String]
String char = new Character((char)i).toString();

[Integer to ASCII Code]
int i = (int) c;

[Integer to Boolean]
boolean b = (i != 0);

[Boolean to Integer]
int i = (b)? 1 : 0;

[Boolean to string]
       boolean theValue = true;
       
        //boolean to String conversion
        String theValueAsString = new Boolean(theValue).toString();
       
        System.out.println(theValueAsString);
Posted by GUCCI
, |

최근에 달린 댓글

글 보관함