Saturday, 7 September 2013

How can i overwrite the localities in an array?

How can i overwrite the localities in an array?

I have a Methos that uses an array with certain numbers of localitites, i
ask to the user the number of the locality to star overwriting.My object
array has other objects in the locatities. Im not sure if what iam doing
with the j variable is correct, the way of moving the objects in the
localities.
public void overwriteArray(int number){
for(int i=0; i<array.length ; i++){
if(i ==(number-1){
for(int j = i ; j<array.length ; j++){
array[j] = array[j+1];}
}
}
}
Is therer any other wayy? or somehting more easy? Thanks!

No comments:

Post a Comment