public static String getOrderIdByUUId() { int first = new Random(10).nextInt(8) + 1; int hashCodeV = UUID.randomUUID().toString().hashCode(); if (hashCodeV < 0) {//有可能是負數 hashCodeV = -hashCodeV; } // 0 代表前面補充0 // 4 代表長度為4 // d 代表參數為正數型 return first + String.format("%015d", hashCodeV); }
