Archives: Type Conversion

Java – Convert String to Long

Output:

String to long conversion using valueOf :2323232
String to long conversion example using Long object: 4444444444444444444
String to long conversion using parseLong() method: 999999999999999999
String to long conversion using decode() method: -1023454
String to long example in hex format decode() method: 65535
String to long example in octal format decode() method: 511

Java – Convert Array to Map using Commons ArrayUtils

This example use the Apache Commons lang’s ArrayUtils class to convert a two dimensional array to a Map object.


Java – Convert Array to List

Output:

How many elements you want to add to the array:
red white green

red white green