Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在java中对长度超过integer.max的数字进行排序_Java_Sorting - Fatal编程技术网

如何在java中对长度超过integer.max的数字进行排序

如何在java中对长度超过integer.max的数字进行排序,java,sorting,Java,Sorting,我想知道如何对长于integer.max的数字进行排序 有人能帮我吗 例如,用户ID 12345678901与12345678900?使用long类型,并对long值数组进行排序 您可以使用类型Long或biginger 但是长类型可能会解决您的问题,因为您的最大值更大 Long.MAX_VALUE is 2^63-1 = 9223372036854775807 对于order,您可以使用ArrayList并在集合中调用sort方法,如下所示: List<Long> values

我想知道如何对长于integer.max的数字进行排序

有人能帮我吗


例如,用户ID 12345678901与12345678900?

使用
long
类型,并对
long
值数组进行排序

您可以使用类型
Long
biginger

但是长类型可能会解决您的问题,因为您的最大值更大

Long.MAX_VALUE is 2^63-1 = 9223372036854775807
对于order,您可以使用ArrayList并在集合中调用sort方法,如下所示:

List<Long> values = new ArrayList<>();
//put all values in your list.
Collections.sort(values);
List values=new ArrayList();
//将所有值放入列表中。
集合。排序(值);

您是否尝试过此方法,发布该代码使用
long
如果long不够,则使用
biginger