import java.util.*;


public class Solution {
    
    public class ComparaInteger implements Comparator<Integer> {
        @Override
        public int compare(Integer num1, Integer num2) {
            return num1 - num2;
        }
    }
    
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param nums int整型ArrayList 
     * @return int整型ArrayList
     */
    public ArrayList<Integer> sortedArray (ArrayList<Integer> nums) {
        // write code here
        for (int i = 0; i < nums.size(); i++) {
            int val = nums.get(i);
            nums.set(i, (int) Math.pow(val, 2));
        }
        nums.sort(new ComparaInteger());
        return nums;
    }
}