使用多线程
ExecutorService executor = Executors.newCachedThreadPool(); for(int i=0;i<threadNum;i++){ String[] tempOrderIds = copyOrderIds(i, orderThresholdNum,orderNum,orderIds); executor.execute(()->{ try { doSomething(tempOrdersIds); } catch (Exception ex) { ex.printStackTrace(); } }); }