Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Conversion from multiple ints to single string

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Conversion from multiple ints to single string

    I'm passing a bunch of ints to this method...and want to convert them all to one string with spaces in between the ints

    ex. "1 4 8 9"

    I'm not sure how to use the wrapper class of Integer with more than 1 int...

    public String process_Job(int arrival, int pid, int cputime, int jobclock, int Qclock, int llq){
     
     
            String string = "" + arrival " " + pid " " + cputime " " + jobclock " " + Qclock " " + llq;     
     
        }        
     
     
    String string = Integer.toString(i);


  2. #2
    Member
    Join Date
    Feb 2011
    Posts
    55
    My Mood
    Tolerant
    Thanks
    1
    Thanked 16 Times in 15 Posts

    Default Re: Conversion from multiple ints to single string

    What? I'm confused, you already have them in a single string with spaces between them. remove String string = Integer.toString(i); and just return string in the method.

Similar Threads

  1. [SOLVED] Splitting String by Multiple Delimiters
    By relixus in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 4th, 2011, 08:54 PM
  2. Externally sorting ints as fast as possible
    By Djikstrangle in forum Algorithms & Recursion
    Replies: 4
    Last Post: September 21st, 2010, 03:00 PM
  3. adding multiple ints into a string
    By straw in forum Java Theory & Questions
    Replies: 1
    Last Post: March 18th, 2010, 06:02 PM
  4. New person Just trying to read a file of ints
    By dubois.ford in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: March 7th, 2010, 11:47 PM
  5. [SOLVED] utf-16 byte[] to string conversion
    By Gerhardl in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 25th, 2010, 07:06 AM