• Post Reply Bookmark Topic Watch Topic
  • New Topic

how can i represent my array better  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using an array of double in a cli environment, there are many types of double integer stored in it. some are zeros , some are double. My problem is when i am using the following code to represent it , its not aligned properly please help me in this regard. I have attached the output. Thank you .

Capture.jpg
[Thumbnail for Capture.jpg]
this is how it looks like
 
Greenhorn
Posts: 14
BSD Eclipse IDE VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
deepak bhai wrote:represent it , its not aligned properly please help me in this regard. ]


A very easy way is to use String.fomat(...) instead of java.lang.DecimalFormat and specify the width and precision

The following code produces an 2x2 array of right aligned float values

 
Ranch Hand
Posts: 70
1
Chrome Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try:

 
deepak bhai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you so much for your replies. Your method is working like a charm Souza . thanks Andi.
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a section in the Java Tutorials which I think will help a lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!