- public class Test10 {
- public static void main(String[] args) {
- String str = "我ABC汉DEF";
- byte b []= str.getBytes();
- int num = 6;
- if(b[5]<0&&b[6]<0) {
- System.out.println(new String(b,0,num-1));
- }else{
- System.out.println(new String(b,0,6));
- }
- }
- }
复制代码 我得测试题,写的不完善,就那么个意思,你再组织一下吧 |