public static long getTransferRateInBytesPerSecond(long bytes, long durationInNS) {
    bytes = Math.max(bytes, 0);
    durationInNS = Math.max(durationInNS, 1);
    double durationInSeconds = (double) durationInNS / TimeUnit.SECONDS.toNanos(1);
    return (long) (bytes / durationInSeconds);
  }
@Test
  public void testGetTransferRateInBytesPerSecond() {
    assertEquals(999_999_999, DFSUtil.getTransferRateInBytesPerSecond(1L, 1L));
    assertEquals(999_999_999, DFSUtil.getTransferRateInBytesPerSecond(1L, 0L));
    assertEquals(102_400_000,
        DFSUtil.getTransferRateInBytesPerSecond(512_000_000L, 5_000_000_000L));
  }