The transformation of integers and strings in Java __java
Source: Internet
Author: User
1. How to convert string strings to integer int
int i = Integer.parseint (str);
int i = integer.valueof (my_str). Intvalue ();
Note: The string turns into a double, Float, long with a similar method.
2. How to convert string strings to integers
Integer integer=integer.valueof (i)
3. How to convert integer int to string string.
Answer: There are three ways:
String s = string.valueof (i);
String s = integer.tostring (i);
String s = "" + I;
Note: Double, Float, and Long turn into strings are very similar.
4. How to convert an int to integer
Integer integer=new integer (i)
5. How to convert integers to string strings
Integer integer=string ()
6. How to convert integer to int
int Num=integer.intvalue ()
7. How to convert string to BigDecimal
BigDecimal d_id=new BigDecimal (str)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service