编辑代码

import java.util.Arrays;
import java.util.List;

public class GreedyChange {
    public static void main(String[] args) {
        int amount = 63;
        Integer[] coins = {25, 10, 5, 1};
        List<Integer> coinList = Arrays.asList(coins);

        coinList.sort((a, b) -> b - a);

        for (int coin : coinList) {
            while (amount >= coin) {
                amount -= coin;
                System.out.print(coin + " ");
            }
        }
    }
}