【发布时间】:2012-08-29 10:46:35
【问题描述】:
我正在编写 Robolectric 中的一些代码,即IntegerResourceLoader。当rawValue 是 0xFFFF0000 之类的东西时,以下方法会抛出 RuntimeException:
@Override
public Object convertRawValue( String rawValue ) {
try {
return Integer.parseInt( rawValue );
} catch ( NumberFormatException nfe ) {
throw new RuntimeException( rawValue + " is not an integer." );
}
}
我尝试使用 Integer.decode(String),但即使语法似乎正确,也会引发 NumberFormatException。
【问题讨论】:
标签: java integer hex robolectric