帮助浮动的降序 [英] Help with decending order for float

查看:78
本文介绍了帮助浮动的降序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助降序浮动。我试图按降序排序小数#。当我运行该程序时,它不会解决它。任何人都可以帮我吗?



Help with Decending order for float. I am trying to sort out decimal #'s in Decending order. When i go run the program it dosen't sort it out. Can anyone help me out?

import java.util.Arrays;

public class SelectionSort {

	public static void main(String[] args) {
	
	// initialize a new float array
	float[] a = new float[]{1.12f,7.32f,3.21f,1.07f,9.2f,1.7f,10.12f};
	
	
	java.util.Collections.reverseOrder();
	
	// print the sorted array of float
	System.out.println(Arrays.toString(a));

	}
}

What I have tried:

I tried Array.sort. now im trying java.util.

推荐答案

也许如果你传递了想要对该函数进行排序的数组,它会有所帮助: br />
Perhaps if you passed the array you wanted to sort to the function, it would help:
java.util.Collections.reverseOrder();

它不是猜猜你想要排序的东西!

< a href =https://www.geeksforgeeks.org/collections-reverseorder-java-examples/> Java中的Collections.reverseOrder()示例 - GeeksforGeeks [ ^ ]

It's not about to guess what you wanted to sort!
Collections.reverseOrder() in Java with Examples - GeeksforGeeks[^]


这篇关于帮助浮动的降序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆