Combining two StringBuffer array elements into a single array element

I just need to know how to combine two stringBuffer array elements into one
StringBuffer ciphertext [] = new StringBuffer[2];
          StringBuffer s0 = new StringBuffer("11011111111110001001101110110101");
          StringBuffer s1 = new StringBuffer("00010011001101000101011101111001");
          ciphertext[0] = s0;
          ciphertext[1] = s1;
          ciphertext[2] = ciphertext[0].append(ciphertext[1]);I get an array index out of bounds exception:2
Thanks

StringBuffer ciphertext [] = new StringBuffer[3];  // legal index values are: 0,1,2

Similar Messages

  • How do I combine two or more pictures into one?

    How do I combine two or more pictures into one?

    I found out how to do what I wanted and I'm giving my steps in hopes that it might help someone else.  I wanted to put several photos from a file onto a new blank image.  This is what I did.
    1.  Create a blank page.    File/New/ Blank File.   Put in the size.  I used 8x10.
    2.  Bring the photo  you want to use into Elements as you always do. It will list along the top next to the blank sheet.
    3.  Choose SELECT (top of screen)/ Select All.
    4.  Choose Edit/Copy   or Command "C"
    5.  Click on the Blank File.   Chose Edit/Paste  or Command "V"
    6.  Click on Image/ Transform or Command "T".  There should be a dotted line around your pasted image.  You can then move and adjust the image to how you want it.  When finished, press the check-mark on lower right of photo.
    7.   Repeat this with all the photos you want on the new blank file.
    8.  You will see on lower right of Elements,  the background layer and as many layers as you have photos.  These layers need to be permanently placed on the background layer. Go to Layers and press Merge Visible.  This will merge all layers to the background.
    9.  Save as and you are done.

  • Merging two separate MUSE sites into a single MENU system and Paid & online BC eCommerce site

    Hi all! I am stuck trying to figure out a Process Conundrum:
    1> I have a BC site with e-commerce ready to go - paid - online with store template in place.
    2> I also Have a 2nd MUSE created web site (with the client content/pages) that needs to merge with that E-commerce BC site. 
    What is the move to merge the two separate sites into a single site with the Menus all in proper order?
    Is this simple and I can not see it? (merge the two sites in a folder and reopen in muse for new menus?
    Or do i need Dreamweaver to assist in the merge?
    In other words:
    What is the PATH/PROCESS to merge a 2nd MUSE designed web site (sans e-commerce), in order to tie into the online BC e-commerce template paid site - so the menus update together as "one" site?
    Menu Update Concern:  merging two separate MUSE sites into a single MENU system with the "Paid on line Active BC e-commerce Template". How do it do it Process wise so that the menus adjust automatically... so they are "one" menu.
    Reminds me of an old joke: Q: "What did the Buddhist say to the hot dog vendor at the ball park?"
    A: "Make me one with everything!"
    ONWARD>>>>>
    Possible paths I am about to take attempting to Solve the problem - and scale the learning curve...
    download the BC e-commerce site into Dreamweaver -
    export the 2nd muse site by publishing it to a unique folder.
    combine them by going back into dream weaver and attempting to figure out linking the menus. - perhaps they are automatic there too.
    or load them both up to BC and back down to MUSE to fix the menus?
    I appreciate Any recommendations, hits or humor that you could help on this.
    Cheers!

    Thanks, Liam... I will get it eventually...
    Sadly: I do not have a budget to hire this out...
       -  I have gone through lots of the BC and Muse training exercises. Adobe
       and BC Gurus.
    But... if the only problem is that I need to work though my partner site BC
    interface...
       - that would be fine...
       - so would using dream weaver....
    I will go back and review the BC interface and also dreamweaver
    capabilities.
    without a budget... i need to figure it out... please do point to any
    material or training you might be able to point me to.
    I don't have to use muse, if that is my sticking point. I just need to get
    the project up and BC looks perfect.
    Thanks.

  • How to add elements into java string array?

    I open a file and want to put the contents in a string array. I tried as below.
    String[] names;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
                    String item = s.next();
                    item.trim();
                    email = item;
                    names = email;
                }But I know that this is a wrong way of adding elements into my string array names []. How do I do it? Thanks.

    Actually you cannot increase the size of a String array. But you can create a temp array with the lengt = lengthofarray+1 and use arraycopy method to copy all elements to new array, then you can assign the value of string at the end of the temp array
    I would use this one:
    String [] sArray = null;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
        String item = s.next();
        item.trim();
        email = item;
        sArray = addToStringArray(sArray, email);
    * Method for increasing the size of a String Array with the given string.
    * Given string will be added at the end of the String array.
    * @param sArray String array to be increased. If null, an array will be returned with one element: String s
    * @param s String to be added to the end of the array. If null, sArray will be returned.(No change)
    * @return sArray increased with String s
    public String[] addToStringArray (String[] sArray, String s){
         if (sArray == null){
              if (s!= null){
                   String[] temp = {s};
                   return temp;
              }else{
                   return null;
         }else{
              if (s!= null){
                   String[] temp = new String[sArray.length+1];
                   System.arraycopy(sArray,0,temp,0,sArray.length);
                   temp[temp.length-1] = s;
                   return temp;
              }else{
                   return sArray;
    }Edited by: mimdalli on May 4, 2009 8:22 AM
    Edited by: mimdalli on May 4, 2009 8:26 AM
    Edited by: mimdalli on May 4, 2009 8:27 AM

  • How do I combine two one page documents into one two page document?

    How do I combine two one page documents into on two page document?????

    Menu > View > Show Thumbnails > Click on the thumbnail > Copy > Paste into the Thumbnails of the 2nd document
    Peter

  • How do I combine two user iPhoto files into one...keeps blocking the pics between users

    How do I combine two user iPhoto files into one...keeps blocking the pics between users on the same Mac?

    Put the library on an external hard drive that is formatted as shown in this screenshot:
    OT

  • Combining two like cd's into one in my library

    how do i combine two like cd's into one

    Give each CD its own disc number as Disc X of Y where in this case X would be 1 or 2, and Y would be 2. Then give both discs a common Album name and a common Album Artist.
    Personally I prefer to use sequential track numbers across both discs as well. For example if disc 1 has tracks 1-12 and disc 2 has tracks 1-13 I would renumber the tracks on the second disc as 13-25 and set a track total of 25 for all tracks on both discs.
    For more details see Grouping tracks into albums.
    tt2

  • Combining Contents of 2 PDFs into a single page PDF

    I need to combine elements of two different PDFs into one, single page PDF.   
    One PDF is Template of sorts with headers to be edited, the other PDF is a non-ocr scan that includes text and images.   
    I've found no way to copy and paste on a single page b.t two PDFs. I've tried pasting into an inserted page and then dragging it up or cutting and pasting within the document (with the intention of deleting the unneeded second page) with no luck.
    This seems like it should be such a no brainer. Open 1st PDF, Open 2nd PDF, make selection Ctrl C, go to 1st PDF, place cursor where desired, Ctrl V.   But it doesn't work at all in an intuitive way like any other document program where you can cut and paste with ease b/t documents and even b/t programs.
    So instead, I've copied the part of the image PDF I want into the original word doc of the template, then created a PDF from that.  However, when I try to tell Acrobat to make the entire document OCR, it tells me it can’t b/c it contains renderable text (the header information, I’m assuming).  If I run the OCR on a PDF containing just the image, it does it no problem.   
    What is the best way to bring these two documents together in way that results in a single page, completely searchable PDF? 

    Unfortunately, another $700 software purchase is not in the cards and I can’t wrap my mind around why it should be necessary.  It seems so nonsensical to me that Acrobat has all these advanced functions for editing, combining, making portfolios etc., yet can not perform the simple task of cutting and pasting between two documents.
    While Adobe support was putting me on hold, I doodled up some generic sample documents that I could upload here to illustrate the problem. Hopefully, someone can play with these and give me a workable solution.
    The first PDF, Original Acme Clip, represents the file that is provided to me by our clipping service. They cut the item out of a magazine, put the customized info into their standard template in whatever word processing program they use, printed it out, pasted the magazine clip to that page and then scanned the hard copy to PDF-as an image only PDF, it is not optimized for optical character recognition and is not searchable.
    The second PDF, Final Acme PDF, represents the file that our workflow eventually ends up as-a PDF containing only the info we want, formatted as we want, in which both the headers and clip content are searchable. To get there currently, we print out the Original ACME Clip, type the relevant info into the headers of a Word template that includes our logo and standard footer, print out the Word template page, manually cut out the scanned image from the PDF, and paste it onto the template paper.  The resulting paper is scanned into the Final Acme PDF and OCR is run on the whole thing to make it all searchable.
    What we’d like to do is skip all the printing, and manual cutting and pasting. Any and all suggestions for work in Acrobat 9 Pro to do this would be gratefully appreciated!

  • I would like to combine two external hard drives into one?  How do I go about doing this?

    Hello:   In iPhoto I have an old external hard drive (EHD) with a photo library and a new one EHD with a photo library which has more space.  I would like to move all the photos from the old EHD to the new EDH.  Can you show me the steps to get this done so I don't lose any of my photos? I just want to use the new EHD only after the move.

    Connect both drives to your mac.
    Quit iPhoto, if it is runinning.
    If both your iPhoto libraries have the same name, rename one of them, perhaps "iPhoto Library 1.photolibrary" and "iPhoto Library 2.photolibrary", so you will not overwrite one of them, when you move them to the same drive.
    Select the library one in the Finder and drag it from the old drive to the new drive.
    Now launch iPhoto while depressing the option (alt) key and selecting the library in the new location. This way you can switch between the libraries.
    If you want to combine the two libraries into one single library, you will need another program. iPhoto Library Manager can merge libraries into one. 
    Download here: iPhoto Library Manager

  • Error combining Power Point 2007 files into a single pdf (Acrobat 11)

    Hi,  Am running Acrobat 11 and am getting an error when attempting to combine files.  Trying to combine multiple power point 2007 files into a single PDF using Acrobat 11.  Am getting an error "unable to find Adobe PDF resource files.  Do you want to run the installer in repair mode".  If choose yes or no I get the yellow error icon beside the PP files and eventually have to cancel the job.
    Any help would be greatly appreciated.

    Hi,
    Please see http://helpx.adobe.com/acrobat/kb/error-unable-create-pdf-resource.html
    Try the suggestions mentioned in this KB doc.

  • Combining two iDVD burned DVDs on a single DVD (regular or DL)

    Any insight appreciated:
    Does any one know if it is possible to combine two iDVD burned DVDs (burned with iDVD current in 2002) on a single DVD either single or double layer?
    17" Flat Panel 1GHz G4 1 GB RAM 80GB Internal   Mac OS X (10.4.3)   iLife '05 (iDVD 5.0.1 and iMovie 5.0.2) on internal, iDVD projects on 300GB LaCie external

    This has been solved. Downloaded and used a program called Handbrake and it successfully extracted the movies, iDVD could read and with a new menu the combined effort was successfull.

  • Combining two different Chart types into one graph

    Hi All,
      I am developing a graphical BW report using WAD. I need to place two differnt chart types into one graph.For example, I have Volume and Quantity .Here the volume should be displayed in Bars and Quantity should be displayed in Lines in the same graph. X axis(Country) is same for these two . I am not sure how to achieve this. Please do let me know if anyone has solution for this.
    Thanks for your time.
    Thanks & Regards,
    Raja

    Hi Andreas,
      One word I can say is 'Perfect' . Even though I am out of office now,I hope the example perfectly will solve my problem.I will try it.
    Thanks for Aduri and Pcrao also for their suggestions .
    Thanks again and I assigned points to all to say my thanks
    Regards,
    Raja

  • How to combine two pages (not files) into one long vertical page

    Is there a way in Acrobat 9 Pro to combine (concatenate) say two 8.5"x11" pages and create a single 8.5"x22" page?
    Right now I'm having to do this by importing one page into Photoshop, extending the canvas, and pasting in the second page into the extended canvas space.  Very kludgy. While this works, saving the resulting PDF (even after removing the option to preserve editability in Photoshop) still results in a file which is a whopping 2.5MB in size as compared with around 25KB for the original PDF file which was spanning 2 pages.
    Ultimately what I'm trying to do is to be able to view a long document which was created in MS Word 2007 and then saved as a PDF, in a web browser by scrolling, without having page breaks.  Trying to increase the page dimensions is MS Word 2007 prior to creating the PDF worked to a point but Word 2007's maximum page length is 22 inches and as luck would have it, the document requires about 23 inches in length.
    I've tried using the custom page setting under the crop tool in Acrobat 9 but I can't seem to get the modified page dimensions to be accepted.  Acrobat 9 seems to accept the input and then nothing changes with the page's dimensions.

    A simple way to accomplish the job, though not recommended is to print the 2 page file to a new PDF with multi-up (assuming you select vertical rather than horizontal locations) and adjust the paper in the Adobe PDF printer to be 8.5X22. At least you might give it a shot. Some variation, along with rotation possibly, might work.

  • Combining two seperate pagemaker files into one pagemaker file.

    We are having done two seperate pagemaking files in two different systems. We are in need to combine/join these two pagemaker publications into one pagemaker publication. How to do this?

    There's several options.
    1. If the two publications are on different PCs, then create a PDF of each and combine them in Acrobat.
    2.Use the Book utility to combine the files when you print.  They need to be on the same PC.
    3. If the two publications are on the same PC (with all the necessary fonts and images), and the files are small, i.e. no more than a few pages, then open both publications in PM.  Tile the two publications side by side.  Add the required number of new pages to the first document, and have "New page 1" opposite "Page 1" of the second publication.
    With the pointer tool selected in the second publication, click Edit - Select All.  Then quickly drag all the objects acroos to "New Page 1" in the first publication.
    Do the same for the remaining pages - hence the requirement for not having too many pages.
    Use File - Save As to save the first publication with a new filename.  All links to images will be preserved.

  • Combining two ArrayLists of Integers into a new ArrayList.

    Basicly I have two arrayLists that have a list of numbers and I want to add them both into one new arrayList in the same index. Example
    aList1 = [ 4 , 5 , 10 , 33 ]
    aList2 = [ 1 , 3 , 19 ]
    combinedList = aList1 + aList2
    print out combinedList = [4,5,10,33,1,3,9]
    That's what I want out of it but the only way I can do this is if I write
    combinedList.add[aList1]
    combinedList.add[aList2]
    but it would come out like [ 4 , 5 , 10 , 33 ] [ 1 , 3 , 19 ]. Two seperate indexs holding a list of Integers. Where I need it to be [4 , 5 , 10 , 33 , 1 , 3 , 9]
    Which is incorrect cause they are in seperate indexs. I need to place both of them into the same index starting with all the numbers for aList1 and then aList2.
    I could just go through each aList1 index and placed each one into a new arrayList and then do that with aList2 but I'm trying to make this a little more efficient than that. I tried using addAll but it seems to add each arrayLists as an object and that just comes out like 2. Here's some of the code from by program.
    Collections.sort(alist1);
    Collections.sort(alist2);
    aNewList.add(alist1);
    aNewList.add(alist2);   
    return aNewList;Like I said I could do it the long way but I'm trying to keep the complexity to a minimum. Any help would be very much appreciated. Thanks :)
    Edited by: DavidMilot on Oct 18, 2008 6:08 PM

    DavidMilot wrote:
    Not to be rude I just cannot copy and paste all my code into the forum out of fear of plagerism.I didn't mean for you to post all of your code. Just a small program that demonstrates the problem. This program would have 3 arraylists on it, 2 filled, one empty that would receive the other two. You combine them, print out the third and that's it.
    I could rename all my variables and method names but I unfortunately don't have time to do all that because I have 3 midterms coming in 3-4 days. This doesn't seem to be an easy fix just by giving out minimal code (which the names have been altered) but I still appreciate the effort. For now I tend to leave the code the way it is havingThe onus of effort here must be yours.
    newList.add(aList1)
    newList.add(aList2)
    It's not perfect but that's as close as I can get for now. Plus this assignment is due monday hehe. Feel free to continue giving me ideas to try out I plan to ask my TA monday before handing it in. Thanks again.I mainly wanted to see is if you are using addAll two add both aList1 and aList2. For some unknown reason in the code you posted before you didn't. Again, lord knows why.

Maybe you are looking for