• 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-6629f800a7781099347527/] 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-6629f800a80db237460111/] Above constructor convert String representation of BigDecimal to BigDecimal Let’s see this with the help of example: [crayon-6629f800a80e2235106676/] […]

  • 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-6629f800a8892832056155/] 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-6629f800a89d5098426962/] 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-6629f800a8e7b518797344/] String getBytes Example: [crayon-6629f800a8e80344797976/] When you run above program, you will get below output: [crayon-6629f800a8e81003859325/] There is one more overloaded method for getBytes Method syntax: [crayon-6629f800a8e83853236458/] 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-6629f800a99aa246287324/] When you run above program, you will get below output [crayon-6629f800a99b0760379428/] 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-6629f800a9a8e864762984/] When you run above program, you will get below output: [crayon-6629f800a9a91617784570/] Other String Programs are : String : How to reverse String in java How to check if […]