String倒转

把string转换成byte数组,再按照一定的规则编译这个数组               
  
String a = "abcdefghjk";
		String s = "";
		byte[] chString = a.getBytes();
		byte[] a1 = new byte[chString.length];
		int lent = chString.length;
		for(int i=0;i<lent;i++){
			a1[lent-i-1] = chString[i];
		}
		System.out.println(new String(a1));

你可能感兴趣的:(String)