Making one big String with the same char

I need to generate a String which represents only one char n-times.
Something like:
String str = new String(char Source, int iRepeat)
String str = new String('x', 5);
str = 'xxxxx';
Thanks in advance!

public String createString(char c, int n) {
  StringBuffer sb = new StringBuffer();
  for ( int y=0; y <= n; y++ ) {
     sb.append(c);
  return sb.toString();
}that should work.
always use string buffers when youre appending text. when you change the value of a STRING object, the jvm actually creates a new string in memory, and just changes the reference to the new string (since each variable you declare as STRING is actually just a reference). this isnt a problem with small strings, but if you create a string thats fairly large, youll notice a huge performance difference. so, just use Strings for storing values, and StringBuffers for string values you plan on changing often.

Similar Messages

  • TS3367 I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling m

    I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling mine.

    Each device needs a separate address. Use an email address (gmail.com) on the iPad.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
     Cheers, Tom

  • I traded my iphone in and now have a new one (iPhone 5) with the same SIM.  Since, I have had some iMessages meant for someone else and some strange things happening on my phone (applications opening by themselves, calls disappearing from log). Any ideas?

    I traded my iphone in and now have a new one (iPhone 5) with the same SIM.  Since, I have had some iMessages meant for someone else and some strange things happening on my phone (applications opening by themselves, calls disappearing from log). Any ideas?

    The answer is very simple: You were not the original owner of the phone. Target sold you a phone that had been returned. You can verify the date of the original sale here: Apple - Support - Check Your Service and Support Coverage. I suspect you will find that the warranty expiration date is not one year from the date that you bought it.

  • HT1473 Often times when I copy a CD into my library it breaks the CD into more than one Album, all with the same name but with only a few of the songs on each. This happens whenever the CD has music with more than one artists...like maybe duets.

    Often times when I copy a CD into my library it will break my CD into multiple albums in my library, each with only a few songs.
    Usually this is because there might be songs where the artists has other artists in the song.
    How can I compile all of the different albums (all with the same name by the way) back into one as was the original disc?

    Generally all you need to do is fill in an appropriate Album Artist. For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
    tt2

  • Can't download more than one iBook created with the same template

    Hi,
    I created 3 books in iBooks Author, using the same template. I uploaded these books to my server. I can dowload anyone of them to iPad, but when I try to download the second one, nothing happens: the first I downloaded is still there.
    I changed the books name: nothing.
    I used other template, 3 books: same problem.
    When I created a bookwith other template, it's OK.
    iBooks Author: 2.0 (327)
    iBooks: 3.0.1 (1223)
    iPad: iOS 5.1.1 (the problem also occurs in iOS 6
    Mac OS X 10.7.5

    this is a new issue.
    try saving each book as a template before publishing.
    change the new file names slightly and publish from each template file
    hope this helps...

  • How can I display a compilation album as one album rather than as separate songs? (each different artist shows with the same album art)

    I want a compilation album, consisting of different artists, to all be included within the one album folder.  Currently when scrolling through my ipod classic each artist has its own album folder, even though they originate from the same album e.g. "The Best Rock 'n' Roll Album in the World Ever" consists of two discs (50 songs).  Each artist's song shows as a 'separate album' of one song, each with the same album artwork.  I want all of those on Disc 1 to be under one album cover and similarly for those on Disc 2.

    Select all the tracks on disc 1 and via Get Info, change the Album Artist to Various Artists and turn on the compilation flag. This is iTunes 12:
    Then repeat for disc 2.

  • Question on multiple form elements with the same name !

    Hi All,
    I have a requirement in which more than one text field with the same name exists on a HTML page. We are using JSF framework (Oracle JDeveloper IDE and OC4J ) . I tried using a String array in my backing bean to handle these text boxes. When I hit the Submit, the action (method) is not invoked. But when I try with unique names everything works fine. Am I going wrong somewhere ?
    Thanks in Advance.

    You cannot have exactly the same name on objects.
    You will have to make an array of them to be able to
    o work with them properly--it will keep the names
    unique.I understand! But JSF creates its own names which are unique. The following JSF code
            <htm:tr>
                <htm:td>
                    <h:inputText value="#{Test.description}" id="description1"/>
                </htm:td>
            </htm:tr>
            <htm:tr>
                <htm:td>
                    <h:inputText value="#{Test.description}"  id="description2"/>
                </htm:td>
        </htm:tr>generates the following HTML code with unique names.
            <tr>
                <td>
                    <input id="Test:description1" type="text" name="Test:description1" />
                </td>
            </tr>
            <tr>
                <td>
                    <input id="Test:description2" type="text" name="Test:description2" />
                </td>
        </tr>
        <tr>Though I have a String Array in the backing bean, this doesn't work (The form does not submit to the method in the Backing Bean).
    Similar situation in Struts works absolutely fine.
    Any help would be appreciated !!!

  • Three tables with the same table name in the same user account

    Windows XP with 10.2.0.1.0
    What is the best strategy to handle the following tasks? Thanks in advance.
    I need to have three different version of database with the same tablename and under the same user name.
    So, I can choose which version of table I need.
    For instance:
    version1:
    create table history(col1 varchar2(20),col2 varchar2(10) ,col3 varchar2(30));
    with data:
    version2:
    create table history(col1 varchar2(20),col2 varchar2(10), col3 varchar2(30) ,col4 number ,col5 number);
    version3:
    history is an union by version1 and version2

    782150 wrote:
    Windows XP with 10.2.0.1.0
    What is the best strategy to handle the following tasks? Thanks in advance.
    I need to have three different version of database with the same tablename and under the same user name.
    So, I can choose which version of table I need.
    For instance:
    version1:
    create table history(col1 varchar2(20),col2 varchar2(10) ,col3 varchar2(30));
    with data:
    version2:
    create table history(col1 varchar2(20),col2 varchar2(10), col3 varchar2(30) ,col4 number ,col5 number);
    version3:
    history is an union by version1 and version2You can't unless you delete the previous table one table only with the same name

  • Multiple video tracks with the same audio track

    How do I get DVDSP to play the same audio track on 3 different video tracks without having to repeat the audio on each of the 3 video trax?
    Seems simple, but I can't find an easy way to do it.
    Anybody got any ideas?

    Yes they are all one continuous stream with the same GOP structure and everything. I had to export them as QT movies from FCP to get them all the same. I only exported the video though becuase the audio was going to be the same for all the tracks, & it was already done as AC3 through Compressor. Which brings up an interesting question; why does DVDSP convert the AC3 audio to .aiff which is a much larger format?
    I'm trying to go back and look at the encoding log from DVDSP to see what error it gave.
    It doesn't give the error in the log since I had shut down my computer last night, so I guess I'll have to try the build again and see what error it gives.
    I'm looking at the parsing files and .m2v files that DVDSP did during the build, and it parsed all 3 angles, and finished the .m2v file of the medium shot, including 6 minutes past the point I told DVDSP to stop it. (When exporting the QT movie from FCP, I had forgotton and encoded the whole 2:30:00 show instead of the 1st 1/2 of 1:16:47:15, and then just adjusted the end of the clip in DVDSP).
    The wide shot and Close up .m2v files, and the audio .aiff file were in the folder, but have nothing in them. The Video_TS folder and Audio_TS folder are also there, but with nothing in them, so whatever happened, seems to have happened in the medium shot encoding process.
    I'm pretty much over this multi-angle thing, and I'm going to start working on an edited version of this today because all I have to do is make the cuts between cameras, since the audio is already mixed. However, if you have any other ideas, please let me know.

  • How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    Phone A = phone with information you want duplicated
    Phone B = phone that you want to copy from A
    Backup Phone A.
    Wipe Phone B using these instructions. What to do before selling or giving away your iPhone, iPad, or iPod touch - Apple Support
    Phone B should be on the 'Hello' screen. Do not swipe it. Launch iTunes. Plug in Phone B.
    When iTunes asks if you want to set up as new phone or restore from backup, choose restore from backup of Phone A.
    After this setup, any changes to one phone (i.e. adding a contact, downloading an app) will have to be manually duplicated on the second phone, if that is your desire). Making changes to one phone will not affect the other after setup.

  • WebLogic Error : Registered more than one instance with the same objectName

    HI there, I'm facing a big problem. I have two environments installed on the same physical machine.
    I have ALSB and WLI servers running out there.
    Environment 1 - WLI port running at 7011 domain name : stp_wli_domain and ALSB port running at 8011 domain name: stp_alsb_homo1 - folders- stp_wli_domain / stp_bea_alsb_homo
    Environmnet 2 - WLI port running at 7211 domain name : stp_wli_domain2 and ALSB port tunning at 8211 domain name : stp-alsb_homo2 - folders - stp_wli_domain2 / stp_bea-alsb_homo2
    Everything was working fine, but these days I had install new deployments on both environment and I got this error :
    java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : stp_wli_domain:ServerRuntime=wli_wls01,Name=stp_wli_domain,Location=wli_wls01,Type=AIRuntime new:com.bea.wlai.management.AIRuntimeMBeanImpl@bcf22dc existing com.bea.wlai.management.AIRuntimeMBeanImpl@de02e6c
    The weird is : There is no same object name, as you can see, domains are different, folders are different and ports are diferrent, including multicast addresses.
    Have you guys seen this before ?
    I'm under pressure here, 'cause some projects had stopped to work.
    Please I would appreciate any help.
    Tks.
    Edson

    HI there, thanks for attention..
    See ...
    There's a lot of confusion with these env's .
    I did not built this, so... I'm cleaning my hands.... anyway... :)
    I must fix....
    Well basically if we have two env's, so we have different project each one right ?
    Ok, but I was told that if you have on the same network and same physical machine the name of AdminServer as "AdminServer" in all domains, so it goes with problems... I never heard about it... but is a good practice you put the names for example :
    WLI - WLIAdminServer
    ALSB - AlsbAdminServer
    WLI2 - WLiadminServer2
    ALSB2 - ALsbAdminServer2
    I would do it.. this way..
    But how it wasn't me...
    We got..
    WLI - WliAdminServer
    ALsb - AdminServer
    WLI2 - AdminServer
    ALsb2 - AdminServer
    Have you got it ?
    So... I was told that this could be a problem, almost all AdminServers with the same name... guess what ?Some Projects are back to work. but not at all.. only some.. so I 'm breathing better now... but I would like to know if you seen this before ?
    I would appreciate your help again.
    Unfortunately there's no detailed stack trace to track this
    Tks.

  • How do i create more than one account in Mail with the same isp?

    I am using suddenlink and have set up one account for Mail. It seems to work ok. I want to set up two others with the same provider but can't.
    Let's call the first account, account1
    It works.
    I set up another and call it account2.
    It is using the same provider which already has the account set up on their end, but how do I set it up to work on my end? Does it need to use the same username as account1 or can it use the user name for account2? I hope this makes sense.
    I just want to use three email addresses from the same provider with mail. I need some help. Please?

    Initially you need to configure via the provider's own web based control panel multiple e-mail accounts. If they don't have one, work it out with their customer support to have three distinct mail accounts. Then you can setup multiple logins by adding new accounts to mail. Since mail checks all accounts per Mac OS X user account simultaneously, it probably is best to use different usernames on the same internet provider. If you don't want mail to show all the information from all three mail accounts simultaneously, configure Apple menu -> System Preferences -> Accounts to have multiple users on your computer, and configure each of the internet service provider accounts for each separaet user on Mac OS X.
    Message was edited by: a brody

  • If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    Actually, everyone missed one point, when a device is priced, the cost of icloud storage space for that device is also included in it that is why they are able to give you 5gb each for each user ID, in nutshell there is nothing free coming with apple device purchase, it is paid for.  What they are trying by giving only 5gb per user ID irrespective of the number of devices used is pure broadlight looting, they take money from you when you buy each device and give you nothing, This is a case of goods and services bought but not fully deliverd ie apple can be suied for discreminatory treatment towards it's users. I wonder why no one tried this yet in America where everyone sue everyone for petty things..... there is no one to take up this issue? . if tim got any love for the guys who shell out money for the devices his company makes, he should be implimenting this as priority before someone wake up from sleep and sue him.

  • Is there a way to delete all events with the same title (not added as reoccurring) without deleting one at a time?

    i currently have a calendar synced that has events scheduled in perpetuity, scheduled as individual events.  I would like to delete all events with the same title.  I do not want to delete the entire calendar nor do I want to go into every event and delete individually.  These were not scheduled by me so I do not know how they were added one by one and go on forever but they are NOT scheduled as reoccurring and thus must be modified individually.
    I can do a search and find all events, is there a way to just delete all events with the same title all at once?
    this is a Microsoft outlook synced calendar and I am seemingly unable to delete the events all at one time from Microsoft as well. 
    Please help!

    If you still have access to the Outlook calendar in Outlook, I would delete them from there. There are a number of ways to do that, but if you open the individual event in Outlook, does it show a repeating pattern? If not, then you may have to delete them individually, but that is not that difficult either. Go into the calendar and then change the view to a list view. From there you can sort the view according to subject. This should bring all of these same appointments together in the list and you can select the group in Outlook and delete them. Once you do that, you can change your view back and then sync the phone. That will remove the events from the phone.

  • I tried to make another account on my school Macbook Pro, made the Admin, account with the same name as the one I was using, deleted it and then all my desktop data is gone.

    So, the problem is,
    I used these school Macs right? They're school handed and stuff. Then one day I decided I want admin so I do this thing where I "reset" everything on the Macbook using this Video (at the bottom) http://www.wikihow.com/Reset-a-Lost-Admin-Password-on-Mac-OS-X
    Then I do it, it takes me to the new User. That's not what I want so I shut down, then made an account with the same name as my current account (let's call it Y). Then I delete Y on purpose. I deleted it because I didn't want my school to know I had this account. Realise I wanted it again so I made an account, let's call it X then when I have X I deleted Y. Then I realised my AirDrop name said X so then I made a new account, this time let's call it Z, with Z I delete X and then I deleted Z because I don't want my school to know I have Z but then Z is also the same name as my main/current account. Somehow or something I delete my current account leaving me with Z. Now I can see my account and stuff but don't know how to restore it.
    Picture will be provides later.
    PLEASE PLEASE PLEASE HELP ME. I HAVE SCHOOL TOMORROW AND I DON'T WANT MY PARENTS TO FIND OUT.

    It is a bad idea to hack computer passwords when you don't own the computer
    Good luck with the school and the parents.

Maybe you are looking for

  • HT4759 How do I get my calendar to Sync across my iPhone, IPad & Mac ?

    I recently upgraded to Maverik. I used to be able to Sync my Calendar on my IPhone, IPad and Mac under Itunes. Maverick does not give me this option under Itunes, as it me be done in ICloud. ICloud is not syncing my calendat across all devices.

  • Display Name in From field

    We just upgraded from Messenger server 5.x to 6.2. On 5.x email messages that were sent by the Messenger Server were received and viewed with the displayName in the From field of the message. This is no longer the case with 6.2 We would like to resto

  • My ipad2 is Not charging anymore! what to do?

    please i Need help.. what should i do??

  • API's used to perform Subinventory Transfer.

    Hi, My requirement is to make Subinventory Transfer automated. So could anyone help me in this regard. What are all the API's and Tables were used to automate the Subinventory Transfer process. And what are all the steps do I need to take care. Thank

  • Tags from other tag output

    Hello. I'm currently outputting tags from a TagSupport extended class.. (doing database checks, then outputting the results and using tags) The tags i output don"t get evaluated and i see them in the html source. How can i make the container evaluate