1、字符串截取
String s="1234abc1234";
System.out.println(s.substring(4, s.length()-4));
运行结果 abc
2、数组截取
char[] data = {'1','2','3','4','a','b','c','1','2','3','4'};
System.out.println(Arrays.copyOfRange((char[]) data, 4, ((char[]) data).length-4));
运行结果 abc
String s="1234abc1234";
System.out.println(s.substring(4, s.length()-4));
运行结果 abc
2、数组截取
char[] data = {'1','2','3','4','a','b','c','1','2','3','4'};
System.out.println(Arrays.copyOfRange((char[]) data, 4, ((char[]) data).length-4));
运行结果 abc