public void customerSorting() { for (int p = 0; p < this.customer.size(); p++) { Customer customer1 = this.customer.get(p); for (int i = 0; i < this.customer.size(); i++) { Customer customer2 = this.customer.get(i); int compare = customer1.compareTo(customer2); if (compare % 10 < 2) { int customer1Index = this.customer.indexOf(customer1); this.customer.remove(i); this.customer.add(i, customer1); this.customer.remove(customer1Index); this.customer.add(customer1Index, customer2); customer1 = customer2; } } } }