Here you can find the source of isAllSingleByte(String str)
public static boolean isAllSingleByte(String str)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static boolean isAllSingleByte(String str) { if (str != null) { int len = str.length(); int i = 0; byte[] b; try { b = str.getBytes("GBK"); } catch (UnsupportedEncodingException e) { e.printStackTrace();//from www.j av a2 s . com b = str.getBytes(); } while (i < len && b[i] < 128) { i++; } if (i < len) return false; return true; } return false; } }