| Index: chrome/android/java/src/org/chromium/chrome/browser/ConversionUtils.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ConversionUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/ConversionUtils.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..95ea232e5fee54711b7400fbd0ba60047896f061
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ConversionUtils.java
|
| @@ -0,0 +1,26 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser;
|
| +
|
| +/**
|
| + * A class containing some utility static methods for common conversions.
|
| + */
|
| +public class ConversionUtils {
|
| + public static final int BYTES_PER_KILOBYTE = 1024;
|
| + public static final int BYTES_PER_MEGABYTE = 1024 * 1024;
|
| + public static final int BYTES_PER_GIGABYTE = 1024 * 1024 * 1024;
|
| +
|
| + public int bytesToKilobytes(int bytes) {
|
| + return bytes / BYTES_PER_KILOBYTE;
|
| + }
|
| +
|
| + public int bytesToMegabytes(int bytes) {
|
| + return bytes / BYTES_PER_MEGABYTE;
|
| + }
|
| +
|
| + public int bytesToGigabytes(int bytes) {
|
| + return bytes / BYTES_PER_GIGABYTE;
|
| + }
|
| +}
|
|
|