CodeKru
Menu

Tutorial archive

Category: <span>Java conversions</span>

Browse individual tutorials and references.

9 published articles

Java

How to convert String to double in Java?

In this post, we will be looking at different ways of converting a string object into a double value.

Java

How to convert double to String in Java

There are many ways to convert a double value into a string in Java. Double.toString() method String.valueOf() method Using + operator Using StringBuilder or StringBuffer append() function Using DecimalFormat Let's look…

Java

How to convert a double to an int in Java?

Before proceeding, there are few points that we should know about While converting double to an int, the decimal values will be lost ( 3.14 would be converted 3 ).

Java

How to convert long to int in Java?

There are different ways of converting a long to an int in Java. Math.toIntExact() method intValue() method Using Strings There is a reason that our list does not contain direct typecasting of long into an int because…

Java

How to convert String to long in Java

In this post, we will be looking at different ways of converting String to long in Java.

Java

How to convert String to int in Java?

In this post, we will be looking at different ways of converting String to int in Java.

Java

How to convert long to String in Java

There are many scenarios where we may be required to convert a long to a String. This post will discuss how we can convert a long integer to a string type in Java.

Java

How to convert an int to a string in java?

This post will look at various ways of converting an int to a String in Java. Below are some of the many ways of converting an int to a String - Integer.toString() method String.ValueOf() method Using + operator Using…

Java

Convert list to map in java

We often come up with requirements where we need to convert the list into a map. In this article, we will learn how to do it before and after Java 8.