• Post Reply Bookmark Topic Watch Topic
  • New Topic

Formatting problem  RSS feed

 
rosy Jovita
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I created a program to check the filesystem usage using sigar.IT works but I have problem with the
formatting. I wanted to display the data in a table like this:

Filesystem Total Available Use type
c:\ 24Gb 13Gb 11Gb NTFs/local
D:\

but this is the output of my program:

*****************************************
*** Checking file system disk status: ***
*****************************************

Filesystem Size Used Avail Use% Type
C:\
D:\
F:\
[ 37G, 13G, 24G, NTFS/local]
[ 37G, 8.4G, 29G, NTFS/local]
[ 0 , 0 , 0 , cdrom/cdrom]
Press any key to continue...

Yes, it looks very funny but I'm really out of idea on fixing this formatting problem.

Below are my codes:


Can someone please help me?I'm not a java expert, looking forward for replies.
Thanks.
 
Rose Rimsky
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rosy, well, the output is displayed like that because in your code you are printing them in that order. First all the Filesystems:

Then you print all the other data:

I suggest that you may try to print everything at the same time, well at least the data of each filesystem and the filesystem name

For example, you can avoid printing the filesystem names in your first "for" and printing that names in your second "for". You can even discard the use of an ArrayList and just print the info, something like this:

By the way, did you notice that you're missing the value of "Use%"? In the code you posted, you're only printing four elements instead of five in your ArrayList.

Hope this helps you!
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with sockets. Although it is related to I/O, the main issue is more general, so that's where this thread is going: Java in General.
 
rosy Jovita
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi rose,
thanks a lot..It works!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!