Here you can find the source of utf8Len(byte b)
public static int utf8Len(byte b)
//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 }