import java.util.Scanner; public class Test1 { public static void main(String[] args){ Scanner sc =new Scanner(System.in); String input = sc.next(); char[] arr = input.toCharArray(); int len =arr.length; int n = (len % 16 == 0)?(len/16):(len/16+1); char[][] smallChar = new char[n][16]; //构建二维数组 for(int i=0;i<len;i++){ smallChar[i/16][i%16] =arr[i]; } for(int i=0;i<smallChar.length;i++){ StringBuffer sb =new StringBuffer(); //16进制偏置 sb.append(String.format("%08x", i*16)); sb.append(" "); //16进制打印 for(int j=0;j<smallChar[i].length;j++){ sb.append(Integer.toHexString((int)smallChar[i][j])+" "); } //字符打印 for(int j=0;j<smallChar[i].length;j++){ sb.append(smallChar[i][j]); } System.out.println(sb.toString()); } sc.close(); } }