Constructor | Type | Description |
| Hbar | Initializes the Hbar object |
new Hbar(<amount>)
Construct hbars from different representations.
Method | Type | Description |
| long / BigDecimal | Returns an Hbar whose value is equal to the specified value |
| long / BigDecimal , HbarUnit | Returns an Hbar representing the value in the given units |
| CharSequence | Converts the provided string into an amount of hbars |
| CharSequence, HbarUnit | Converts the provided string into an amount of hbars |
| long | Returns an Hbar converted from the specified number of tinybars |
Java//100 hbarsnew Hbar(1000);//100 hbars from hbar valueHbar.from(100);//100 tinybars from hbars convert to unitHbar.from(100, HbarUnit.TINYBAR);// 100 hbars converted from string valueHbar.fromString("100");//100 tinybars from string valueHbar.fromString("100", HbarUnit.TINYBAR);//v2.0.0
JavaScript// 100 hbarsnew Hbar(1000);//100 hbarsHbar.from(100);//100 tinybarsHbar.from(100, HbarUnit.TINYBAR);// 100 hbars converted from string valueHbar.fromString("100");//100 tinybars from string valueHbar.fromString("100", HbarUnit.TINYBAR);
Go//100 hbarshedera.NewHbar(100)//100 tinybarshedera.HbarFrom(100, hedera.HbarUnits.Tinybar)//v2.0.0
Method | Type | Description |
| HbarUnit | Hbars from the provided denomination |
| long | Hbars converted from tinybars |
Java//100 hbars converted to tinybarsHbar.from(100, HbarUnit.Tinybar);//Hbars from tinybarsHbar.fromTinybar(100);//v1.3.2
JavaScript//100 hbars converted to tinybarsHbar.from(100, HbarUnit.Tinybar);//Hbars from tinybarsHbar.fromTinybar(100);//v1.4.4
Convert hbars to a different unit/format.
Method | Type | Description |
| HbarUnit | Specifiy the unit of hbar to convert to. Use |
| HbarUnit | String value of the hbar unit to convert to. Use |
| Long | Hbar value converted to tinybars |
Java//100 hbars converted to tinybarsnew Hbar(100).to(HbarUnit.TINYBAR);//100 hbars converted to tinybarsnew Hbar(100).toString(HbarUnit.TINYBAR);//100 hbars converted to tinybarsnew Hbar(100).toTinybars();//v2.0.0
JavaScript//100 hbars converted to tinybarsnew Hbar(100).to(HbarUnit.TINYBAR);//100 hbars converted to tinybarsnew Hbar(100).toString(HbarUnit.TINYBAR);//100 hbars converted to tinybarsnew Hbar(100).toTinybars();
Go//100 hbars converted to tinybarshedera.NewHbar(100).As(hedera.HbarUnits.Tinybar)//100 hbars to string formathedera.NewHbar(100).String()//100 hbars converted to tinybarshedera.NewHbar(100).AsTinybar()//v2.0.0
Method | Type | Description |
| HbarUnit | Specifiy the unit of hbar to convert to. Use |
| Long | Hbar value converted to tinybars |
Java//100 hbars converted to tinybarsnew Hbar(100).as(HbarUnit.Tinybar);//100 hbars converted to tinybarsnew Hbar(100).toTinybars();//v1.3.2
JavaScript//100 hbars converted to tinybarsnew Hbar(100).as(HbarUnit.Tinybar);//100 hbars converted to tinybarsnew Hbar(100).toTinybars();//v1.4.4
Provided constant values of hbars.
Method | Type | Description |
| Hbar | A constant value of the maximum number of hbars (50_000_000_000 hbars) |
| Hbar | A constant value of the minimum number of hbars (-50_000_000_000 hbars) |
| Hbar | A constant value of zero hbars |
Java//The maximum number of hbarsHbar hbarMax = Hbar.MAX;//The minimum number of hbarsHbar hbarMin = Hbar.MIN;//A constant value of zero hbarsHbar hbarZero = Hbar.ZERO;//v2.0.0
JavaScript//The maximum number of hbarsconst hbarMax = Hbar.MAX;//The minimum number of hbarsconst hbarMin = Hbar.MIN;//A constant value of zero hbarsconst hbarZero = Hbar.ZERO;
Go//The maximum number of hbarshbarMax := hedera.MaxHbar//The minimum number of hbarshbarMin := hedera.MinHbar//A constant value of zero hbarshbarZero := hedera.ZeroHbar//v2.0.0
Method | Type | Description |
| Hbar | A constant value of the maximum number of hbars (50_000_000_000 hbars) |
| Hbar | A constant value of the minimum number of hbars (-50_000_000_000 hbars) |
| Hbar | A constant value of zero hbars |
Java//The maximum number of hbarsHbar hbarMax = Hbar.MAX;//The minimum number of hbarsHbar hbarMin = Hbar.MIN;//Zero hbarsHbar hbarZero = Hbar.ZERO;//v1.3.2
JavaScript//The maximum number of hbarsconst hbarMax = Hbar.MAX;//The minimum number of hbarsconst hbarMin = Hbar.MIN;//Zero hbarsconst hbarZero = Hbar.ZERO;//v1.4.4
Modify the hbar representation to one of the hbar denominations.
Function | Description |
| The atomic (smallest) unit of hbar, used natively by the Hedera network |
| Equivalent to 100 tinybar or 1⁄1,000,000 hbar. |
| Equivalent to 100,000 tinybar or 1⁄1,000 hbar |
| The base unit of hbar, equivalent to 100 million tinybar. |
| Equivalent to 1 thousand hbar or 100 billion tinybar.HbarUnit.Megbar |
| Equivalent to 1 million hbar or 100 trillion tinybar. |
| Equivalent to 1 billion hbar or 100 quadillion tinybar. |
Java//100 tinybarsHbar.from(100, HbarUnit.TINYBAR);//v2.0.0
JavaScript//100 tinybarsHbar.from(100, HbarUnit.TINYBAR);//v2.0.0
Go//100 tinybarshedera.HbarFrom(100, hedera.HbarUnits.Tinybar)//v2.0.0
Function | Description |
| The atomic (smallest) unit of hbar, used natively by the Hedera network |
| Equivalent to 100 tinybar or 1⁄1,000,000 hbar. |
| Equivalent to 100,000 tinybar or 1⁄1,000 hbar |
| The base unit of hbar, equivalent to 100 million tinybar. |
| Equivalent to 1 thousand hbar or 100 billion tinybar.HbarUnit.Megbar |
| Equivalent to 1 million hbar or 100 trillion tinybar. |
| Equivalent to 1 billion hbar or 100 quadillion tinybar. |
JavaHbar.from(100, HbarUnit.Tinybar);//v1.3.2
JavaScriptHbar.from(100, HbarUnit.Tinybar);//v1.4.4