Byte and other types of conversion

Source: Internet
Author: User

Byte []-> string system. Text. encoding. Default. getstring
-> Basestring tobase64string
String-> byte [] encoding. utf7.getbytes (string) public static byte [] urldecodetobytes (string );

Char []-> string new string (char [] value );
String-> char [] string. tochararray ()
Char []-> byte [] Byte [] encoding. utf7.getbytes (char []);
Byte []-> char [] encoding. utf7.getchars (byte []);
Char []-> byte -----------------------------
Char-> byte convert. tobyte
Byte-> char convert. tochar
Byte []-> char bitconverter. tochar (char []) // This class can be converted from byte [] to various types

String-> Byte "8"-> 8 byte. parse ()
Byte-> string 7-> "7"

Byte -- 8 255
Char-16 65535
Unicode-16 65535
String-16 65535

 

 

Buffer. blockcopy () // operate byte./other Arrays

Array. Copy () // operate byte./other Arrays

Bitconverter, which can easily convert other primitive types (except string) to byte []
Convert. tostring (INT, 2) binary display

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.