java
java逆数组如何print-凯发ag旗舰厅登录网址下载
/** 来自 nowjava.com**/
//package com.nowjava;
public class main {
public static void main(string[] argv) throws exception {
object[] arr = new string[] { "1", "abc", "level", null,
"nowjava.com", "asdf 123" };
system.out.println(java.util.arrays.tostring(conversearray(arr)));
}
public static object[] conversearray(object[] arr) {
object para = null;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;//来自 nowjava - 时 代 java
}
public static int[] conversearray(int[] arr) {
int para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;
}
public static char[] conversearray(char[] arr) {
char para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;
}
public static byte[] conversearray(byte[] arr) {
byte para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;
}
public static short[] conversearray(short[] arr) {
short para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;
}
public static long[] conversearray(long[] arr) {
long para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
arr[i] = arr[arr.length - 1 - i];
arr[arr.length - 1 - i] = para;
}
return arr;
}
public static float[] conversearray(float[] arr) {
float para;
for (int i = 0; i <= arr.length / 2; i ) {
para = arr[i];
/**代码未完, 请加载全部代码(nowjava.com).**/
总结
以上是凯发ag旗舰厅登录网址下载为你收集整理的java逆数组如何print_java 逆数组的全部内容,希望文章能够帮你解决所遇到的问题。
如果觉得凯发ag旗舰厅登录网址下载网站内容还不错,欢迎将凯发ag旗舰厅登录网址下载推荐给好友。
- 上一篇: java try finally con
- 下一篇: .net 访问mysql链接池_c# –