String str = "65465"; boolean isGB2312; if (str.getBytes().length == str.length()) { isGB2312 = false; System.out.println("不带汉字"); } else { isGB2312 = true; System.out.println("带汉字"); }