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-676807cd65691912441408/] 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-676807cd65929396340561/] Above constructor convert String representation of BigDecimal to BigDecimal Let’s see this with the help of example: [crayon-676807cd6592e961838460/] […]
- 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-676807cd65a71130576206/] 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-676807cd65b6d727946650/] 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-676807cd65c08187087676/] String getBytes Example: [crayon-676807cd65c0a009214262/] When you run above program, you will get below output: [crayon-676807cd65c0b948720779/] There is one more overloaded method for getBytes Method syntax: [crayon-676807cd65c0d516749992/] 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-676807cd65cf8870510155/] When you run above program, you will get below output [crayon-676807cd65cfd341642313/] 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-676807cd65dee134839690/] When you run above program, you will get below output: [crayon-676807cd65df1717596815/] Other String Programs are : String : How to reverse String in java How to check if […]