```
public int[] maxSlidingWindow(int[] nums, int k) {
if (nums.length == 0) {
int[] store = {};
return store;
}
if (nums.length <= k) {
int[] store = new int[1];
Arrays.sort(nums);
store[0] = nums[nums.length - 1];
return store;
}
int[] store = new int[nums.length - k + 1];
PriorityQueue<Integer> pq = new PriorityQueue<>();
for (int i = 0; i < k; i++) {
pq.add(-nums[i]);
}
store[0] = -pq.peek();
for (int i = k; i < nums.length; i++) {
pq.remove(-nums[i - k]);
pq.add(-nums[i]);
store[i-k+1] = -pq.peek();
}
return store;
}
```

since the element we want to order is just number, we can use the default comparator. However, the default comparator will peek the smallest element. Thus, we add the opposite number to the queue and return the opposite number of peeked element