Java tutorial
//package com.java2s; import android.annotation.SuppressLint; import java.nio.charset.Charset; public class Main { private static int getMaxLength(Object[] msgs) { int max = 0; int tmp; for (Object oo : msgs) { tmp = getBytesLength(oo.toString()); if (tmp > max) { max = tmp; } } return max; } @SuppressLint("NewApi") private static int getBytesLength(String msg) { return msg.getBytes(Charset.forName("GB2312")).length; } }