Conversion
- 05 October
Java BigDecimal to String
In this post, we will see how to convert BigDecimal to String in java. There are many ways to convert BigDecimal to String in java. Some of them are: Using toString() Using String.valueOf() toString method You can simply use BigDecimal’s toString method to convert BigDecimal to String. [crayon-6729ad9558761066974042/] When you run above program, you will […]
- 05 October
Java String to BigDecimal
In this post, we will see how to convert String to BigDecimal in java. It is very simple to convert String to BigDecimal in java. You can simply use BigDecimal ‘s String based constructor to do it. [crayon-6729ad955913c341705058/] Above constructor convert String representation of BigDecimal to BigDecimal Let’s see this with the help of example: [crayon-6729ad9559144136751928/] […]
- 24 September
How to convert List to Set in java
In this post, we will see how to convert List to Set in java.We will convert ArrayList to HashSet. As HashSet does not allow duplicates, when you convert ArrayList to HashSet, all the duplicates will be discarded. You can simply use the constructor of HashSet to convert ArrayList to HashSet. [crayon-6729ad955a17d766087585/] Here is simple example: […]
- 21 October
How to convert Byte Array to String in java
Sometimes, we may need to convert String to bytes Array but how to convert bytes array to String back. toString method does not work correctly here as it just print bytes in String format. You can use String’s constructor to get String back. Example: [crayon-6729ad955a316030275052/] When you run above program, you will get below output: […]
- 24 May
How to convert String to Byte array in java
Sometimes, we need to convert String to byte array. We can use getBytes() method of String to do it, Method syntax: [crayon-6729ad955a3cf458228949/] String getBytes Example: [crayon-6729ad955a3d1178098395/] When you run above program, you will get below output: [crayon-6729ad955a3d3934011025/] There is one more overloaded method for getBytes Method syntax: [crayon-6729ad955a3d4957330521/] It encodes String to specified charset format. […]
- 04 May
How to convert Char Array to String in java
There are multiple ways to convert Char Array to String in java. Some of them are: Using String class’s constructor (By passing Char array to contructor) Using String class’s valueOf method Using iterating char array Example: [crayon-6729ad955a4eb355718263/] When you run above program, you will get below output [crayon-6729ad955a4ef625347346/] Other String Programs are : How to […]
- 04 May
How to convert String to Char Array in java
Java String’s toCharArray() method can be used to convert String to char Array in java. It is simplest method to convert String to char Array. Example: [crayon-6729ad955a594065208625/] When you run above program, you will get below output: [crayon-6729ad955a597946167482/] Other String Programs are : String : How to reverse String in java How to check if […]