Posted by: Ayus March 3, 2011
IT -- Solutions Center[Forum]
Login in to Rate this Post:     0       ?        
@prankster,

Yes we can but its under util package. " " is a space.
For somebody who needs to write in C#, importing java package might be more confusing.

We can so somethign like
String format = "%10.2f\n"; // width == 10 and 2 digits after the dot
  float [] floats = {123.45f, 99.0f, 23.2f, 45.0f};
  for(int i=0; i<floats.length; i++) {
    float value = floats[i];
    System.out.format(format, value);
}
output:
123.45
 99.00
 23.20
 45.00




Read Full Discussion Thread for this article