Java bit, byte, bit, byte, kanji, character

Source: Internet
Author: User

     Packagecom.suypower.chengyu.test;  Public classBytetest {/*** Byte 8 bits-128-+ 127 * 1 bit = 12 binary data * 1 byte = 8 bit * 1 letter = 1 byte = 8 bit (bit) * 1 kanji = 2 byte = + bit*/        Public Static voidMain (string[] args) {//TODO auto-generated Method Stub      byteB1 = 127; byteb2 =-128; byteB3 = ' a '; byteB4 = ' A ';//One letter = 1 byte = 8 bit//byte B5 = ' AA '; This is wrong.//byte B6 = ' Medium '; it's a mistake. 2 bytes 16bit       ShortS1 = ' ah ';//a kanji 2 bytes 16bit Short is a bit of//Short s2 = ' kanji '; //2 Kanji 4 bytes The three-bit int is the three-bit//int i1 = ' Kanji '; But int is a numeric type, char is a bit = 2 byte = a kanji      CharC1 = ' Khan '; //byte conversion stringString string = "Chinese"; byteBy[] =string.getbytes (); String Str=NewString (by); System.out.println ("Str=" +str); }            }  ==================================================================================[Java-Original] bit,byte, bits, bytes, kanji, character bit,byte, Bits, Bytes, Chinese characters relations1 bit = 1Binary Data1byte= 8bit1 letter = 1byte= 8bit1 Kanji = 2byte= 16bit1. Bit: bit a binary data 0 or 1, is 1bit;2.byte: The basic unit of measure for byte storage, such as: a VARCHAR defined in MySQL (45) that means 45 bytes;1byte= 8bit3. An English character occupies one byte;1 letter = 1byte= 8bit4. A kanji account of 2 bytes;1 Kanji = 2byte= 16bit5. Punctuation A>. In the Chinese character input state, the default is full-width input mode; B>. In the English input state, the default is half-width input mode; C>. In full-width input mode, punctuation is 2 bytes; D>. In the half-angle input mode, the punctuation mark occupies 1 bytes; therefore: Characters in the Chinese character input state, accounting for 2 bytes (but do not exclude, they changed the default settings); The characters in the English input state, accounting for 1 bytes (but do not exclude, the default settings have changed);

Java bit, byte, bit, byte, kanji, character

Related Article

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.