publicclassAccountHandler{// Public static methodpublicstaticvoidinsertAccount(Integer value){
Integer counter =1;//create a list to add our accounts
List<Account> addAccounts =newList<Account>();try{while(counter <= value){//create a new account
Account acc =newAccount();
acc.Name ='Acme Inc '+ counter;
acc.AccountNumber ='A000'+ counter;
addAccounts.add(acc);//increment the counter
counter = counter +1;}//insert all of the accounts in the list
insert addAccounts;}catch(DmlException e){
System.debug('A DML exception has occurred: '+
e.getMessage());}}}