Java Summary of frequently searched type conversions

Summary of type conversions I often search for

Type conversion between numeric types

int type → double type

int num = 3;
double number = (double)num;

Double type → int type

double num = 3;
int number = (int)num;

Numeric types (such as long) can be converted by adding ** (type to be converted) ** before the variable to be converted.

Type conversion from numeric type to character type

int type → String type

int num = 3;
String number = Integer.toString(num);

Double type → String type

double num = 3.0;
String number = Double.toString(num);

Type conversion from character type to numeric type

String type → int type

String text = "123";
int number = Integer.parseInt(text);

String type → double type

String text = "123";
int number = Double.parseDouble(text);

Reference site

Types and type conversion methods other than the above. [Java] Convert String type to int type

Recommended Posts

Java Summary of frequently searched type conversions
Summary of Java support 2018
[Java11] Stream Summary -Advantages of Stream-
[Java] Summary of regular expressions
[Java] Summary of operators (operator)
Summary of Java language basics
Summary of Java Math class
[Java] Summary of control syntax
Summary of java error processing
[Java] Summary of design patterns
[Java] Summary of mathematical operations
[For beginners] Summary of java constructor
Summary of [Java silver study] package
Summary of frequently used Docker commands
[Java] Correct comparison of String type
Summary of object-oriented programming using Java
[Java Silver] Summary of access modifier points
[Java] Implicit type cast (AOJ10-sum of numbers)
[java] Summary of how to handle char
Summary of changes other than JEP of Java10
[Java] Personal summary of conditional statements (basic)
[Java] [Maven3] Summary of how to use Maven3
[Basic knowledge of Java] About type conversion
[Java] Comparison of String type character strings
Summary of Java Math.random and import (Calendar)
Java type conversion
[java] Summary of how to handle character strings
Java Generics Summary
Summary of Java environment settings for myself [mac]
[JAVA] Stream type
[Java] Personal summary of classes and methods (basic)
[Java] Summary of how to abbreviate lambda expressions
[Java] Enumeration type
Java related summary
Java Optional type
[Java] Be careful of the key type of Map
Java double type
Java 8 documentation summary
Java 11 document summary
[Java] Overview of Java
Java review ③ (Basic usage of arrays / reference type)
Summary of frequently used commands in Rails and Docker
[Java] Basic summary of Java not covered by Progate ~ Part 1 ~
Summary of ToString behavior with Java and Groovy annotations
[Java Silver] Summary of points related to lambda expressions
Summary of revisions (new era) support by Java version
Summary of knowledge required to pass Java SE8 Silver
GetXxxx of ResultSet was addicted to primitive type (Java)
Summary of Java communication API (1) How to use Socket
Summary of Java communication API (3) How to use SocketChannel
List of frequently used Java instructions (for beginners and beginners)
Summary of Java communication API (2) How to use HttpUrlConnection
Summary of how to implement default arguments in Java
Summary of file reading method for each Java file format
Expired collection of java
Predicted Features of Java
Java 12 new feature summary
[Java] Significance of serialVersionUID
[Summary] Java environment preparation
effective java 3rd summary
NIO.2 review of java