@RequestMapping("jz")
@ResponseBody
public Map
Map
try {
int[] num = new int[100];
for (int i = 0; i < 100; i++) {
num[i] = getRandomNum(1, 1000);
}
Stack
for (int i : num) {
stack.push(i);
}
Stack
while (!stack.isEmpty()) {
int cru = stack.pop();
while (!help.isEmpty() && help.peek() < cru) {
stack.push(help.pop());
}
help.push(cru);
}
while (!help.isEmpty()) {
stack.push(help.pop());
}
map.put("ok", stack);
map.put("length", stack.size());
} catch (Exception e) {
e.printStackTrace();
map.put("flag", "error");
}
return map;
}
private static int getRandomNum(int min, int max) {
return (int) (Math.random() * ((max - min) + 1)) + min;
}



