Skip to main content
Close announcements banner

Conversion from a long

Target data type Behavior Examples
String Returns the value as a string. 42L is converted to "42".
Boolean Returns false if the value is 0L and true otherwise. This conversion can cause a loss of data. 42L is converted to true.
Integer Converts the long to an integer if possible, returns an exception otherwise. This conversion can cause a loss of data. 42L is converted to 42.
Decimal Returns the long value as a decimal. 42L is converted to 42.
Double Returns the long value as a double. 42L is converted to 42.0D.
Float Converts the long to a float if possible, returns an exception otherwise. This conversion can cause a loss of data. 42L is converted to 42.0F.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!