JAVA

Long 데이터를 int로 변형 하는 메소드

질주하는구 2015. 8. 27. 11:17
public int safeLongToInt(long l) {
	int i = (int)l;
	if ((long)i != l) {
		throw new IllegalArgumentException(l + " cannot be cast to int without changing its value.");
	}
	return i;
}
반응형