Results 1 to 3 of 3
  1. #1
    Symbiot is offline Member
    Join Date
    May 2010
    Posts
    15
    Rep Power
    0

    Default printing 3 elements in an array on 1 line

    Hi

    I am trying to print some hex text out in an array..

    From a processor I am getting: <d3ff
    I then need to remove <d

    So I created the following code:

    Java Code:
    sentence = inFromServer.readLine();            
                String output = sentence;
                char[] char_array = new char[output.length()];        
                   char_array = output.toCharArray();              
                    for ( int i = 2; i < char_array.length; i++ )             
                    {
                       System.out.print (char_array[i] + "\n" );
    this works, but it prints out each element vertically like:
    3
    f
    f

    I need it to be:
    3ff

    Make sense?

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Java Code:
    for ( int i = 2; i < char_array.length; i++ ){
        System.out.print (char_array[i]);
    }
    System.out.println();
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Symbiot is offline Member
    Join Date
    May 2010
    Posts
    15
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 03-22-2010, 01:50 AM
  2. Replies: 0
    Last Post: 03-10-2010, 02:13 AM
  3. Printing Array elements
    By new person in forum New To Java
    Replies: 2
    Last Post: 02-23-2009, 08:57 PM
  4. Help printing specific ArrayList elements
    By CirKuT in forum New To Java
    Replies: 5
    Last Post: 02-03-2009, 12:24 AM
  5. Issue with printing line
    By Azndaddy in forum Advanced Java
    Replies: 1
    Last Post: 04-04-2008, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •