62,614
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
String number = "000000";
String id = "310141597210452232";
String all = id + number;
byte[] messages = all.getBytes();
for (int i = 0; i < messages.length; i++) {
System.out.println(messages[i]);
}
byte[][] strArray = new byte[3][messages.length / 3];
if (messages.length % 3 == 0) {
for (int i = 0; i < 3; i++) {
strArray[i] = new String(messages, i * messages.length / 3, 8)
.getBytes();
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(strArray[i][j]);
}
System.out.println();
}
}
public static int removeMax(int[] values) {
if (values.length <= 0) {
return -1;
} else {
int temp = 0;
for (int i = 0; i < values.length; i++) {
if (values[temp] < values[i]) {
temp = i;
}
}
// 下边把最大值和数组最后一个值换掉。
values[temp] ^= values[values.length - 1];
values[values.length - 1] ^= values[temp];
values[temp] ^= values[values.length - 1];
return values[values.length - 1];
}
}
public int removemax(int[] array)
{
if(array.length<=0)
{
return -1;
}
else
{
int max=array[0];
int temp=0;
for(int i=1;i<array.length;i++)
{
if(max<array[i])
{
max=array[i];
temp=i;
}
}
//在这里根据temp 往前移位,移位注意数组最后一个数字,尤其最大值是最后一个
return max;
}
}