rest - java 16位数字数据类型

时间:2017-09-05 04:21:11

标签: java type-conversion

我想知道在我的其余api中我应该使用哪个数据类型为16位数字,因为Integer会返回400个错误请求,我不得不将其修改为其他数据类型,

  

org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver.handleTypeMismatch Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Integer]; nested exception is java.lang.NumberFormatException: For input string: "1111111111111111"

谢谢。

1 个答案:

答案 0 :(得分:4)

您只需将其作为String x接受,然后将其转换为BigInteger

BigInteger bigInt = new BigInteger(x);