Java UTF8 utf8Len(byte b)

Here you can find the source of utf8Len(byte b)

Description

utf Len

License

Open Source License

Declaration

public static int utf8Len(byte b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int utf8Len(byte b) {
        int num = b & 255;
        if (num < 0x80)
            return 1;
        if (num < 0xe0)
            return 2;
        if (num < 0xf0)
            return 3;
        if (num < 0xf8)
            return 4;
        return 5;
    }//from  ww w .j  av  a  2 s.co  m
}

Related

  1. utf8BytesToString(byte[] bytes, int start, int length)
  2. utf8BytesToString(final byte[] in_utf8Bytes)
  3. utf8CharLen(byte byte1)
  4. UTF8GetBytes(final String value)
  5. UTF8GetString(final byte[] bytes, final int index, final int count)
  6. utf8Length(byte[] buffer, int str, int len)
  7. utf8Replace(String str)
  8. utf8SafeCEscape(String src)
  9. utf8String(String... strs)