Long sort = 12345L;
// 强行转换
Integer intSort = sort.intValue();
// 安全转换
Integer intSort = Math.toIntExact(sort)
Java Long 转 Integer安全的方法
于 2024-11-05 11:56:17 首次发布
Long sort = 12345L;
// 强行转换
Integer intSort = sort.intValue();
// 安全转换
Integer intSort = Math.toIntExact(sort)