Want to show well-formatted output about bandwidth speed at boot time
I have this calculation below thanks to @Tomasz Nurkiewicz, and it shows mega * bytes * per second when I upload the file.
long start = System.nanoTime(); long totalRead = 0; final double NANOS_PER_SECOND = 1000000000.0; final double BYTES_PER_MIB = 1024 * 1024; while ((val = bis.read(buffer, 0, 1024)) > 0) {
I wish it were so. I get mega * bytes * per second from the calculation, and from this I will enter a if statement to select KByte / s, MBit / s (not sure) or just like the speed of a regular FTP client.
if( KByte/s something) { System.out.print(your current speed xx KB/s); }else if(MByte/s something){ System.out.print(your current speed xx MB/s); }
My problem is that I am inserting into the if? Statement.
hope you understand what I'm trying to do
source share