2 * This file is part of storage-units. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of storage-units,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
7 package de
.xn__ho_hia
.utils
.storage_unit
;
9 import static de
.xn__ho_hia
.utils
.storage_unit
.NullsafeMath
.addNullsafe
;
10 import static de
.xn__ho_hia
.utils
.storage_unit
.NullsafeMath
.asBigInteger
;
11 import static de
.xn__ho_hia
.utils
.storage_unit
.NullsafeMath
.divideNullsafe
;
12 import static de
.xn__ho_hia
.utils
.storage_unit
.NullsafeMath
.multiplyNullsafe
;
13 import static de
.xn__ho_hia
.utils
.storage_unit
.NullsafeMath
.subtractNullsafe
;
15 import java
.math
.BigInteger
;
18 * Zettabyte as specified in ISO IEC 80000-13:2008 (1 Zettabyte = 1 000 000 000 000 000 000 000 Byte).
20 public class Zettabyte
extends StorageUnit
<Zettabyte
> {
22 private static final long serialVersionUID
= 8849006574018911826L;
24 Zettabyte(final BigInteger bytes
) {
29 * @param numberOfBytes
30 * The amount of bytes the zettabyte contains.
31 * @return A new Zettabyte unit with the given value.
33 public static Zettabyte
valueOf(final BigInteger numberOfBytes
) {
34 return new Zettabyte(numberOfBytes
);
38 * @param numberOfBytes
39 * The amount of bytes the zettabytes contains.
40 * @return A new Zettabyte unit with the given value.
42 public static Zettabyte
valueOf(final long numberOfBytes
) {
43 return new Zettabyte(asBigInteger(numberOfBytes
));
47 * @param numberOfBytes
48 * The amount of bytes the zettabytes contains.
49 * @return A new Zettabyte unit with the given value.
51 public static Zettabyte
valueOf(final Long numberOfBytes
) {
52 return valueOf(numberOfBytes
.longValue());
56 public Zettabyte
add(final long bytesToAdd
) {
57 return new Zettabyte(addNullsafe(bytes
, asBigInteger(bytesToAdd
)));
61 public Zettabyte
add(final StorageUnit
<?
> storageAmount
) {
62 return new Zettabyte(addNullsafe(bytes
, storageAmount
.bytes
));
66 public Zettabyte
divide(final long divisor
) {
67 return new Zettabyte(divideNullsafe(bytes
, asBigInteger(divisor
)));
71 public Zettabyte
multiply(final long factor
) {
72 return new Zettabyte(multiplyNullsafe(bytes
, asBigInteger(factor
)));
76 public Zettabyte
subtract(final long bytesToSubtract
) {
77 return new Zettabyte(subtractNullsafe(bytes
, asBigInteger(bytesToSubtract
)));
81 public Zettabyte
subtract(final StorageUnit
<?
> storageAmount
) {
82 return new Zettabyte(subtractNullsafe(bytes
, storageAmount
.bytes
));
86 protected BigInteger
getNumberOfBytesPerUnit() {
87 return StorageUnit
.BYTES_IN_A_ZETTABYTE
;
91 protected String
getSymbol() {
92 return "ZB"; //$NON-NLS-1$