OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.util; |
| 6 |
| 7 /** |
| 8 * A class containing some utility static methods for common conversions. |
| 9 */ |
| 10 public class ConversionUtils { |
| 11 public static final int BYTES_PER_KILOBYTE = 1024; |
| 12 public static final int BYTES_PER_MEGABYTE = 1024 * 1024; |
| 13 public static final int BYTES_PER_GIGABYTE = 1024 * 1024 * 1024; |
| 14 |
| 15 public static long bytesToKilobytes(long bytes) { |
| 16 return bytes / BYTES_PER_KILOBYTE; |
| 17 } |
| 18 |
| 19 public static long bytesToMegabytes(long bytes) { |
| 20 return bytes / BYTES_PER_MEGABYTE; |
| 21 } |
| 22 |
| 23 public static long bytesToGigabytes(long bytes) { |
| 24 return bytes / BYTES_PER_GIGABYTE; |
| 25 } |
| 26 } |
OLD | NEW |