Please Help me on recreating deleted arrays

Hi,
I'm trying to recreate a deleted array as follows:
array=null;
Array array[] = new Array[100];
addToArray("elem1","elem2","elem3");
but doesn't work. I'm unable to recreate/populate the array. Can someone please help me with this?
I declared the array null first because the array was previously existing.
What I need to do is to be able to add array elements dynamically and delete some at the same time.
Deleting some elements seemed to be a complicated process so I thought of deleting the entire array instead then just recreate it and populate with required elements. I should keep the same array name.
Thanks!
Anna

array=null;
Array array[] = new Array[100]; // on this line you declare the variable array once again : the compiler doesn't accept it.
addToArray("elem1","elem2","elem3");
What I need to do is to be able to add array elements
dynamically and delete some at the same time. You can also give a look at the Collection
http://java.sun.com/docs/books/tutorial/collections/implementations/general.html
and especially the class "ArrayList" http://java.sun.com/products/jdk/1.2/docs/api/java/util/ArrayList.html
This class provides methods to add, delete element and dynamically enlarge the array.
Good luck

Similar Messages

  • Please help I just accidentally deleted a very very important note from my "Notes" on my iPhone 4s.  How can I get it back? Is there a "Trash" file somewhere for deleted notes?  Thank you, Susan

    Please help I just accidentally deleted a very very important note from my "Notes" on my iPhone 4s.  How can I get it back?
    Is there a "Trash" file somewhere for deleted notes?
    Thank you,
    Susan

    Had you never backed up the phone before? When you saw the iTunes logo and cable, the device was in recovery mode. The data was already lost. The only way to recover from that is to restore the device, which will delete all of your data. You will only be able to restore to your last backup, whenever that was. Sorry this happened, but this highlights the importance of doing regular backups. The backup is the only protection you have against a problem like this.

  • Please help. I have deleted all my photos from my i phone 5 sometime ago and I have just relaised that they are very imortant for me, can I recover them

    please help. I have deleted all my photos and videos from my i phone 5 sometime ago and I have just relaised that they are very imortant for me, can I recover them at all. the pictures dates back to some time in June 2013

    ozyyy wrote:
    Thank you for your reply. I do not think it was connected to internet and saved in I Tunes or I cloud
    Sorry... but... No Sync + No Backup = No photos.

  • Recreating Deleted Arrays

    Hi,
    I'm trying to recreate a deleted array as follows:
    array=null;
    Array array[] = new Array[100];
    addToArray("elem1","elem2","elem3");
    but doesn't work. I'm unable to recreate/populate the array. Can someone please help me with this?
    Thanks,
    Anna

    I'm not sure what your problem is here...
    Your user defined class:
    public class MyArray {
       private double x;
       private double y;
       private double dx;
       private double dy;
       private boolean fixed;
       private String lbl;
       ... setters/getters
    }An arrayList of your class:
    ArrayList list = new ArrayList();
    list.add(new MyArray());
    MyArray element = (MyArray)list.get(0);Where's the problem?

  • Please help---merge function for two arrays.

    I am trying to create a merge function that merges two sorted arrays into a third array. I know what I am supposed to do, at least in theory, but I have been completely unsuccessful with actually getting the code to work. Since it is private, you can't directly access the arrays, you have to just reference them. could someone please help me out.
    import java.io.*;
    class OrdArray
    private long[] a;
    private int nElms;
    public OrdArray(int max)
    a = new long[max];
    nElms = 0;
    public int size()
    { return nElms;}
    public int find(long searchKey)
    int lowerBound = 0;
    int upperBound = nElms-1;
    int curIn;
    while(true)
    curIn = (lowerBound + upperBound) / 2;
    if(a[curIn]==searchKey)
    return curIn;
    else if (lowerBound > upperBound)
    return nElms;
    else
    if(a[curIn] < searchKey)
    lowerBound = curIn + 1;
    else
    upperBound = curIn - 1;
    public void insert(long value)
    int j;
    for(j=0; j<nElms; j++)
    if(a[j] > value)
    break;
    for(int k=nElms; k>j; k--)
    a[k] = a[k-1];
    a[j] = value;
    nElms++;
    public boolean delete(long value)
    int j = find(value);
    if(j==nElms)
    return false;
    else
    for(int k=j; k<nElms; k++)
    a[k] = a[k+1];
    nElms--;
    return true;
    public void display()
    for(int j=0; j<nElms; j++)
    System.out.print(a[j] + " ");
    System.out.println("");
    public void merge(OrdArray array, OrdArray array1)
    }//this is the start of the merge function. I am stuck and not real sure where to go from here.
    public long getElm(int index)
    return a[index];
    }//end class OrdArray
    class OrderedApp
    public static void main(String[]args)
    int maxSize = 100;
    OrdArray arr, arr1, arr2;
    arr = new OrdArray(maxSize);
    arr1 = new OrdArray(maxSize);
    arr2 = new OrdArray(maxSize);
    arr.insert(77);
    arr.insert(99);
    arr.insert(44);
    arr.insert(55);
    arr.insert(22);
    arr1.insert(88);
    arr1.insert(11);
    arr1.insert(00);
    arr1.insert(66);
    arr1.insert(33);
    arr2.merge(arr, arr1);
    arr.display();
    System.out.println("--------------------");
    arr1.display();
    System.out.println("--------------------");
    arr2.display();
    }

    If I use ArrayList<Long>, would I have to change private long[]a to ArrayList<long>, cause if so, I am not able to do that.
    I am supposed to add a merge() method to megre the two source arrays into an ordered destination array.
    public void merge(OrdArray array, OrdArray array1)
    mergeSize = array.nElems + array1.nElems;
    int i = 0;
    int j = 0;
    int k = 0;
    while (i = 0; i < array.nElems; i++) {
              if {array.getElm(i) < array1.getElm(j)
                                                              //how do you move to the next set of values
                                                              //and to move which variables are incremented
                                                              //how do you test if the flush loop should be      called, hint if( == )
                   while (j = mergeSize - array.nElems; j <= mergeSize; j++) { 
                                   this.a[j] = array1.a;
    //again how do you move to next value and placeholder
         //which indices are incremented
    //copy/paste and change the variables for the other value being smaller
    public long getElm(int index)
    return a[index];
    this is all I have started, but i don't really understand all the comments because I haven't used java in a long time. Like I said, I understand what needs to be done and what order to do it in, but getting the code down to do that is really rough

  • Please Help!! I deleted the folder System en Macintosh HD and now when i on my mac it says Disk Error Press Any  Key To Restart Please HELP !!

    I deleted the folder System en Macintosh HD and now when i on my mac it says Disk Error Press Any  Key To Restart Please HELP !!

    Reinstall Mac OS X.
    (59450)

  • Please help me, I mistakenly deleted a file.  How can I retrieve my file?

    PLease help me retrieve my file.  I was rearranging some docs into sub-files and mistakenly deleted the main file, thinking the sub-files would still be there and they are all gone.  Lots and lots of docs.  PLEASE HELP ME,!!!  The File name was "Cardis, Jackets, Ponchos& Tops Patterns.  I was using the new Adobe Acrobat Reader.

    I don't believe you can if the only copy is on your iPad.
    You must make backups of files which you have on your mobile devices. Then restore from the backup. Backups could easily made by uploading them to Document Cloud, or backing up to another device.

  • Please HELP ME ACCESS OR DELETE MY RESTRICTIONS PASSCODE COZ' EVERYTIME I ENTER MY RESTRICTIONS PASSCODE IT WILL SAYS.. PASSCODE ATTEMPT FAILED.. I AM ATTEMPTING TO ENTER MY RESTRICTIONS PASSCODE SINCE THIS MORNING AND UNTIL NOW I HAVE ENTERED 13 TIMES...

    Please.. HELP ME HOW TO DELETE OR RESET MY RESTRICTIONS PASSCODE BECAUSE EVERYTIME I ENTER MY RESTRICTIONS PASSCODE IT IS ALWAYS PASSCODE ATTEMPT FAILED... I AM STARTING THIS SINCE THIS MORNING BUT UNTIL NOW I CAN'T ACCESS MY RESTRICTIONS PASSCODE... I ENTERED 13 TIMES ALREADY SINCE THIS MORNING... BUT UNTIL NOW ITS USELESS.. I CAN'T VIEW MY OWN BUILT-IN APPS LIKE CAMERA, YOU TUBE, ITUNES, APPS, SAFARI, ICLOUD, TWITTER, FACETIME.... PLEASE HELP ME SOLVE MY PROBLEM ... PLEASE... THANK YOU SO MUCH...

    Please turn off your CAPS LOCK, it's considered shouting and therefore rude.
    If you have forgotten the restrictions passcode the phone will become locked and the only way to use it again will be to restore the phone to factory settings, which will wipe all data from the phone in the process. After restoring the phone you can then restaore it to the last backup that you made.

  • PLEASE HELP!! Restoring deleted items to my iPad

    After syncing tv series from my iPad to my computer I accidentally deleted a couple of tv series on my computer, they then disappeared off my iPad, when I realised what I had done I went to my computers recycle bin and restore the items. Now if I go via my documents to iTunes media on my computer the programmes are there but when I open my iTunes account icon on the computer they do not come up. I really want to get the programmes back on my iPad as they are the children's programmes to watch in the car! Please help!

    If you purchased them via itunes then you can download them back via the cloud. Go into the itunes tv shows and look for the purchased tab on the top right, it will then list everything you've ever purchased. Hit the cloud button and it will start downloading it to your device. Hope this helps!

  • Please help! I accidentally deleted all my data off my iphone

    Please someone help me! I was trying to work out how to use the find my iphone app and accidentally deleted my whole
    content! I have lost my photos, notes, contacts and all this other stuff
    PLEASE HELP ASAP!!

    I'm curious. What is it about this forum, focussed on a now-discontinued productivity application named "AppleWorks", that attracts so many questions like this one, totally unconnected with that application?
    I'd appreciate an answer to that. Meantime, I've requested a transfer of the question to a more appropriate community.
    Regards,
    Barry

  • Please help me! iBooks delete all pdfs then uploads all at every sync.

    Hi everyone, I need some help, much appreciated if anyone can give me a hand. I have hundreds of heavy PDF files I use in a daily basis for Uni, about 10GB in my iPad 3 (the one pre-air) is of PDFs. I ran into an issue today for the first time ever, I uploaded a new file to iBooks via ibook in the iMac (with Maverick) + iTunes as usual and the author had lots of unusual characters something like "%674f88uh7(*&" ok...after that file was upoloaded, all other pdfs started to freeze and not loading anymore. So I delete that file and after that nothing worked since. all files showing that loading icon but nothing..so I deleted my entire library (Noooooo) and uplaoded everything again. Now everytime I add a new pdf, the entire library (10GB) of books go grey, then disappear and start loading 1 by 1 all over again, no more incremental uploads like I used to have before/ I tried all settings possible, but again, if I hit sync on iTunes, the iPad library empties out, and starts loading all books, this takes a long hour to complete...I need help please, what am i doing wrong?
    Thanks!

    Ok, this has happened to me twice now. I've been using weave since pre-1.0.
    The first time I needed to wipe a cluttered firefox profile, then re-merged my sync and while it restored all of my bookmarks, it only caught half my passwords.
    The second time, today, I needed to reinstall windows. I connected to firefox sync and selected merge, but the only bookmarks merged in were those I added recently, likely since the 1.4 update.
    This is very troubling to me as there was never any warning that all of my data would not be secure. It was my fault for depending on it but now several years worth of bookmarks are just gone.
    Am I using it wrong? When a new version comes out do I need to somehow re-sync everything? One would think that is taken care of automatically.
    Please let us know if there is a way to recover our lost data.
    And for the sake of other users please track this down and consider warning people they could lose their data.
    Thank you.

  • Please help! how to delete stereo recording pre final cut express edit

    ok I have recorded over 10 hours of (voiceovers) intstructional material on ishowu HD.. When i started i used my built in mic and everything was good. I could place it in FCE edit in viewer before placing in my sequence. These recording on recording mono (a1) and mono (a2) and i had no problems.
    Somewhere along the way (i believe when i changed from built in mic to plug in usb mic) ishowu began recording mono (a1), mono(a2), and also stereo (a3a4).. With the additional stereo audio folder being recorded it gives me a general error (not enough memory)when i try to put these clips into my viewer and i can't edit or play the clips in FCE. So I have a ton of clips i can not edit in FCE and the general error is killing me.. So basically i have a ton of quicktime files and need to know if it is possible to delete the stereo recording from my voiceover and somehow change it back to just mono a1 and mono a2. Please somebody help!

    I know nothing about iShowU.
    I can say that VO in FCE are always going to be a mono clip entered into only one audio track.
    Why it's arriving as a stereo pair is a mystery to me at the minute.
    Have you trashed your FCE Preferences?
    If you want to make a stereo pair into two mono tracks they can be.
    Are there inward facing little green triangles on the stereo pairs?
    Al

  • Please help - iphone 5 has deleted everything on update..

    Apologies if this has been posted before...i saw a couple of other posts with similar problems but mines slightly different
    My girlfriend went to update her iphone 5 as normal. When she did this, it popped up with a screen showing the itunes logo and the charger wire connecting to it, basically asking to be connected to itunes.
    So she plugged it into my macbook (she doesn't have her own) and it asked to restore it but then said everything (contacts, texts, pictures) etc would be put back on, so we went ahead with it.
    After an hour of this processing and doing something a few times with no options for us to click anything apart from continue, my girlfriends phone is now as if new - no contats, no numbers, no texts, no photo's, no nothing.
    She tried to log into her instagram account which one of the very few apps left on there and it said it needed an upgrade. So she tried to upgrade that and it shows my appleid (from my itunes/  macbook etc) so she can't download it.
    On itunes the only back ups available are ones from the day when she bought it, so hence why they have been reset to having nothing on her phone.
    Apologies for the long winded message, but any help any one can give will be great appreciated.

    Maybe here:
    Restore loop (being prompted to restore again after a restore successfully completes)
    Troubleshoot your USB connection. If the issue persists, out-of-date or incorrectly configured third-party security software may be causing this issue. Please follow Troubleshooting security software issues. .

  • Urgent --Please Help via undo trash delete

    Hi All The Apple User,
    Today afternoon I'm running Boot Camp via Window XP downloaded a Daemon Tools software, however it attached a virus called Mr.Lin Mutation Virus, which is covered by a fake NOD32 Folder, it run automatically when I install the Daemon Tools, in begin it running like the virus scanner, but after restart, all the files and data ( more than 200GB ) in my portable hard drive were completely gone, then just left all the named empty folders in my HD, even the original security application from my portable hard-drive was also being erase.
    However, the part of my Boot Camp was not effect.
    So now that we know the virus running in begin actually was deleting the data from my mac.
    As I remember a years ago I have been tried a software for getting back the deleted file from the trash,
    but now I couldn't find it again.
    So does anyone know how to get it back ? Please lend a hand, there are something important inside.
    Also, does anyone know the way of data delete in the Mac is it as same as the way of Boot Camp ?
    Thanks in advance for your answer and reply.
    BenNovello

    you have a windows virus and it only affects windows partition and windows drive.
    this virus can do nothing to your OS X partition.
    as your problem is exclusively with windows you should ask on a windows forum not on a mac one. there are data recovery windows programs and antivirus windows programs. you need those. but again, ask on a windows forum.

  • Please help safari icon got deleted from my applications!!!

    Hi my safari icon got deleted from my applications! do u no how i can get it back without putting the osx disk back in the computer. thanks

    Hi oliver, Welcome to Apple's Users Help Users Forums.
    Unless you moved it into of the trash and emptied the trash, it's around somewhere. In the trash???
    Did you take it out of the applications folder or off the dock?
    If the dock, it is just an alias and Safari is still in the apps folder.
    Do a search w spotlight or command -f and see if you can find it.
    You can reinstall Safari from the install disc.
    Safari is not included in "Install Bundled Software Only." That's the one that shows near the top of the page. :~(
    Further down is "Optional Installs!" which will allow you to install Safari only. It's in applications.
    An alternate is to download Pacifist and extract it w Pacifist from the install disc.

Maybe you are looking for

  • Upgrade: MacPro 1,1 tp 4,1 & OSX 10.6.8 to 10.7.5. to 10.8

    Am upgrading from a MacPro 1,1 to a MacPro 4,1.12GB with a pair of SSDs (1 Boot and 1 Home), and with a 1TB backup HHD, partitioned at 500GB/500GB, using CCCloner. Will be running four 23" CinemaHD displays, via a Radeo 5770 with active adapters and

  • Mac Mini Yosemite Install - Reboot Back to Mavericks

    I finally decided to upgrade my Mac Mini HTPC to Yosemite. I run the installer, says it's going to install, reboots, does the spinner for a bit, reboots again and I'm back at the login screen in Mavericks. If I login, it's like I never tried to insta

  • How do I set AR as main download?

    Whenevere I go to download a file off the internet, it always uses my phone downloader instead of AR. And I get the error message "unable to download" when I go to open it. So how do I set AR as my default downloader?? Please help!!!

  • Pga and temp

    Hi Sometimes I hit unable to extent temp errors. My db version is oracle 9i. I guess the pga is not set. I am not sure why total PGA inuse has a value in second query.. Is there any impact if I set pga? SQL> show parameter pga NAME TYPE VALUE pga_agg

  • Fn key problem

    I am trying to find a solution to this for quite some time... i am not a software developer and i use ECLIPSE for most of my work.... and it has shortcut for duplicating a line CTRL + ALT + DOWN ARROW KEY... but since i have started using a lenovo la