Convert various numeric types to string types

Source: Internet
Author: User
Convert various numeric types to string types:

String S = string. valueof (value); // The value is of any numeric type.

String type conversion to various numeric types:

String S = "169 ";
Byte B = byte. parsebyte (s );
Short T = short. parseshort (s );
Int I = integer. parseint (s );
Long L = long. parselong (s );
Float F = float. parsefloat (s );
Double D = double. parsedouble (s );

Conversions between numeric types and numeric objects:

Bytes B = 169;
Byte BO = new byte (B );
B = bo. bytevalue ();

Short T = 169;
Short to = new short (t );
T = to. aggregate value ();

Int I = 169;
Integer IO = new INTEGER (I );
I = Io. intvalue ();

Long L = 169;
Long Lo = new long (L );
L = Lo. longvalue ();

Float F = 169f;
Float fo = new float (f );
F = fo. floatvalue ();

Double D = 169f;
Double dobj = new double (d );
D = dobj. doublevalue (); # Java Column

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.