Increasing size of array

is there anyway to increase the size of the array without losing previous information
for example
//String[] words = new String[2];
//words[0] = "Hello";
//words[1] = "Byes";
if i do this
//words = new String[3];
//words[2] = "goodbye";
then the previous two will be lost... is there anyway to go around this... thank you

Option A: use a Vector
Option B: do like Vector does (look at the source to Vector)String[] words = new String[2];
words[0] = "Hello";
words[1] = "Byes";
String tmp = new String[3]     // make a new array
for (int x=0; x<words.length; x++) tmp[x]=words[x];  // copy all old to new array
words = tmp;                   // point variable words to new array
words[3]="goodbye";            // fill last elementVector does this a lot more efficiently than this.

Similar Messages

  • Reducing size of datatype involved in index fails where as increasing size work

    This question is related to my question in SO Database
    events that will cause deletion of index
    For example if i create a table like
    CREATE TABLE dbo.Customers (ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED, CustomerName NVARCHAR(200));
    CREATE INDEX IX_CustomerName ON dbo.Customers(CustomerName);
    And then try to change column datatype like shown below to 230 from 200.
    alter table Customers
    alter column CustomerName nvarchar(230) null
    The above alter command runs successfully and index IX_CustomerName is not dropped.
    But if i try to reduce the size of column to 150 from 200 then it shows error.
    alter table Customers
    alter column CustomerName nvarchar(150) null
    I get error like
    Msg 5074, Level 16, State 1, Line 1
    The index 'IX_CustomerName' is dependent on column 'CustomerName'.
    Msg 4922, Level 16, State 9, Line 1
    ALTER TABLE ALTER COLUMN CustomerName failed because one or more objects access this column.
    So reducing the size(data may loss) of a column does not work if index is present on a column where as if the index not present then above
    query works successfully. So why does it does not allow reducing the column when index present where as increasing size does not show any problem and works?

    Hello,
    Indeed, a little bit strange even because in BOL it's documented for a different behaviour, see
    ALTER TABLE (Transact-SQL) => Remarks =>
    "Changing the Size of a Column
    You can change the length, precision, or scale of a column by specifying a new size for the column data type in the ALTER COLUMN clause. If data exists in the column, the new size cannot be smaller than the maximum size of the data. Also, the column cannot
    be defined in an index, unless the column is a varchar, nvarchar, or varbinary data type and the index is not the result of a PRIMARY KEY constraint. See example P."
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to increase size of check box in sap script

    Hi All,
    I need to include check box in sap script. I included check box using insert>character->sap symbols. I cant able to view check box in print preview but i can able to get check box in print out.Size of check box printed in the paper is not having enough size. I need to increase size of the check box. Give me suggestion for increasing size of check box.
    Regards,
    Peranandam

    Chk the link.
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/80318f454211d189710000e8322d00/frameset.htm

  • How to increase size of button in sap netweaver webdynpro

    hi
    iam using sap netweaver webdynpro
    i have one application i want to increase size of button
    i will increase width but i want ot increase height
    of butto
    how  is it possible
    byeeeeeeee

    Guruvulu,
    Not sure whether it helps, but try this trick: set imageSource to some transparent GIF with necessary height.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • How to increase size of fonts in Menu bar and in Safari toolbar?

    How to increase size of fonts in Menu bar and in Safari toolbar?  Munu bar and Safari toolbar  fonts too small on a 24" iMac screen.
    Thanks in advance !

    If you want to change the size of the font of a TextEdit text document, you do it in the preferences. Alternatively, if you want control over the size of the fonts, make it a Rich Text document, and then you can change the font size. You can either use the Larger or Smaller options, or Show Fonts to choose a size. You can elect to have new documents be Rich Text in the preferences as well.

  • How to increase size of font in Citrix

    How to increase size of font in Citrix  (while I am remoting to the desktop of my work PC)?

    Guruvulu,
    Not sure whether it helps, but try this trick: set imageSource to some transparent GIF with necessary height.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • Adding or increasing size of redo logs

    Hi,
    I launched health Chack of TOAD on my Database and I had :
    ! "Checkpoint not complete" errors: 1744
    ! (consider adding or increasing size of redo logs to resolve this)
    My question is how to
    1- add a logfile ?
    2-increase a logfile ?
    Many thanks.

    The size is set when you create the redo logs you can not adjust this size without going through a lot of hoops. One method of increasing the size is described in metalink note: 1035935.6
    Basically you have to create new log groups of the size you want like
    SQL>alter database add logfile group 4 '/opt/oracle/data/redo4/log4a.dbf' size 10M;
    Do this for as many new groups as you want with the size you want.
    Then when the original groups are INACTIVE which can be seen in the v$log table, drop those groups.
    alter database drop logfile group 1;
    But read the entire note before you do anything.
    Regards
    Tim

  • Safari always loads small window size have to always increase size pressAA several times. How can I have it bigger by default ?

    Safari always loads small window size It leaves a wide margin on both side of the window. I have to always increase size press AA several times. How can I have it bigger by default ?
    Changing the font size does not work. Many Thanks

    Hi Bee
    This is not what I mean. I'm not a new user of computers. Even when the window fills the screen. There are wide boarders either side,  have to press the AA serveral times to increase web page (in the tool bar top left) so that the web page fits the window.

  • Saving images with quality 12 increases size. Why?

    A minutely modifyed image saved with quality of 10 maintained its original size (more or less), but saving with a quality of 12 increases size.
    I would like to know why?
    I'd appreciate your comments.

    Because that's how .jpg works. Sizes of less than 10 usually compress your files somewhat, lower numbers resulting in smaller file sizes and more compression, with a corresponding loss of quality. Sizes greater than 10 also use the .jpg compression algorithm, but they choose less compression, and so two pixels that may have been compressed together at compression 10 may now be separated at compression 11 or 12, resulting in a larger file. (But that doesn't imply an increase in the quality, even at 12 there is still a slight decrease in quality in that the .jpg saved version still doesn't exactly represent what you saw on the screen)
    The amount of modification to the photo doesn't really matter in how much the space the .jpg compression takes up.

  • About the biggest size of array

    I am writting a applet for big data management.
    I need a array such as
    pkeydata=new byte[(short)15000];
    Is it possible?
    I have been asked the technical support of oberthurcs,
    He give the answers:
    //=======================================================
    The applet isn't written in a standard way for JavaCards.
    An example is the allocoation of 15000 bytes of memory.
    I think you should rethink the applet design and no
    allocate memory like that.
    //=========================================================
    Is that true? If that is true ,could you tell me the biggest
    size of array I can allocat?
    TKS

    I am writting a applet for big data management.
    I need a array such as
    pkeydata=new byte[(short)15000];
    Is it possible?It should be possible. Here is a citation from the Javacard VM spec:
    2.2.4 Limitations of the Java Card Virtual Machine
    The limitations of resource-constrained hardware prevent Java Card programs from
    supporting the full range of functionality of certain Java platform features. The
    features in question are supported, but a particular virtual machine may limit the
    range of operation to less than that of the Java platform.
    To ensure a level of portability for application code, this section establishes a
    minimum required level for partial support of these language features.
    The limitations here are listed as maximums from the application programmer?s
    perspective. Applets that do not violate these maximum values can be converted
    into Java Card CAP files, and will be portable across all Java Card implementations.
    From the Java Card virtual machine implementer?s perspective, each maximum
    listed indicates a minimum level of support that will allow portability of applets.
    2.2.4.2 Objects
    Arrays
    Arrays can hold a maximum of 32767 fields. That means: if your applet's code and data requirements are within the given EEPROM range and the used card is specification compliant, the allocation of a byte-array holding 15000 elements should work.
    I have been asked the technical support of
    oberthurcs,
    He give the answers:
    //=====================================================
    The applet isn't written in a standard way for
    JavaCards.
    An example is the allocoation of 15000 bytes of
    memory.
    I think you should rethink the applet design and no
    allocate memory like that.
    //=====================================================
    [..]Afaik there are other card manufacturers e.g. Orga Card Systems, that are supporting the allocation of arrays in that way. Your kind of allocation as described above is according to the spec.
    Hope that helps
    Carsten

  • Did Lion's iTunes remove the video menu options to increase size and reduce size?

    Did Lion's iTunes remove the video menu options to increase size and reduce size?
    Is the ability to shrink or expand the video window from a menu item now really gone? 

    Itunes has not changed in Lion in this regard, you can still go to fullscreen from the menu, and use your input device to make the video window larger and smaller. does that help?

  • HT4972 How can I zoom the web page only vertically or horizontally ,i.e.,wThen I want to read the web page can I enlarge the page so that the font only increases size ?

    How can I zoom the web page only vertically or horizontally ,i.e.,wThen I want to read the web page can I enlarge the page so that the font only increases size ?

    You can't.  (Fonts increase in size like everything else, not in height alone).

  • Can't do the finger spread on trackpad and increase size

    I used to be able to do the the finger spread on trackpad and increase size of pages on internet and some other things like Word. I looked at sys prefs and it's checked. What's up and can I do anything about it?
    Thanks.

    Actually, the problem has been going on for a while, at least a couple weeks, so I have rebooted many times. A bit perplexing. I can do the expansion/contraction thingy in FCP, but not elsewhere that I used to.
    Thanks for the reply!

  • Ur temprory tablespace full . how u resize or increase size of file .

    ur temprory tablespace full . how u resize or increase size of file .u have no more space .how u slove

    Answers in your duplicated thread: Some inter view Questions Please give prefect answer  help me
    You can get all the answers at http://tahiti.oracle.com.
    You understimate job recruiters, a simple crosscheck is enough to discard people with experience from people who memorize 'interview answers'.
    Don't expect to get a job just because you memorize answers for 'job interviews', get real life experience.

  • Acrobat increases size of file when no text is present

    I an using Acrobat 9.  I have a certificate returned from the printers and the size is 115Kb.  I have put 8 lines of text on the entire document and the email size increase to 2985 Kb - no images or pictures in my text.  If I remove all the text and clear the comments totally the size then reverts to 975Kb (approx..)
    Can anybody tell me what is going on because I cannot send a group of certificates of 3Mb each down the wire?

    First of all, check which font you've used for these lines of text. You
    should use either a font that's already embedded in the file, or a standard
    font that's available in Acrobat by default, like Helvetica.
    Also, try saving the file using the Save As method under a new name. This
    forces an optimization of the file and can seriously reduce the file's size.
    On Tue, Aug 12, 2014 at 11:04 AM, bazzer it's me <[email protected]>

Maybe you are looking for

  • How can I distinguish different action mapping in one ActionClass file?

    I would like to create a ActionClass which will handle 3 mapping which comes from /add, /show or /del. My question is how can I change the code so that the ActionClass servlet can distinguish the request from different url mapping ? Can anyone give m

  • ITunes 10.2.1.1, Win 7 (64 bit) Crash when switching Music Videos

    This problem has been plaguing me on both my laptop and desktop machines since early iTunes 10 versions. Randomly iTunes will stop responding when it switches from one Music Video to another and can only be fixed by killing the process and restarting

  • The backup library doesnt show as an option in the file menu

    I want to backup my library to DVDs, but there isn't an option to backup under the File\Library menu.

  • Mpd and ncmpcpp

    well I installed ncmpcpp, but when ever I try to run it I get this: Cannot connect to mpd: problems connecting to "localhost" on port 6600: Connection refused I have no clue what mpd was/is, so I installed it.. and ran "mpd" unable to bind port 6600:

  • Status Record Code

    Hi All, Currently i'm working on custom IDOC and i've done with creation of custon idoc, segment and message type. Now i'm developing the outbound program for Custom IDOC and need to add status code into the program. can anyone send me sample code to