how to insert array item in proper index of sorted array
Hi
i have a class Customer .
class Customerimplements Comparable<Customer>{
int accountID;
String name;
String address;
publicint compareTo(Customer c){
return name.compareToIgnoreCase(c.name);
}
}
in my main(),
publicstaticvoid main(String[] args){
// TODO code application logic here
Customer BankAccount[]=new Customer[30];
for(int i =0;i<BankAccount.length;i++){
BankAccount[i]=new Customer();}
when i want to insert a new record,some records must be right-shifted to make space for the new record.Suppose i want to insert a record with name michael and existing array is
name:low
address:singapore
account id:01
name:shu
address:canada
account id:02
name:juan
address:china
account id:03
so records starting with name shu and onwards to the right can be shifted by one slot to the right so that empty slot is available for the new record.
Does anyone know how to do that?
thanks...>

