package com.isoftstone.interview;
import java.util.Arrays;
import java.util.*;
//字符数组操作集合
public class String_fun {
public static void main(String[] args) {
String[] aArray = new String[5];
String[] bArray = { "a", "b", "c", "d", "e" };
String[] cArray = new String[] { "a", "b", "c", "d", "e" };
int[] array = { 1, 2, 3, 4, 5 };
String to_union = Arrays.toString(array); // 把 array什 加载进 to_union 并输出
System.out.println("to_union 值为" + to_union);
String[] str2 = { "a", "b", "c", "d", "e" }; // ,用类名调用 方法;
ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList(str2));
System.out.println("arrayList的值为" + arrayList);
// 检查一个数组是否包含某个值
String[] Arr1 = new String[] { "a", "b", "c", "d", "e" };
boolean b = (Arrays.asList(Arr1)).contains("a"); // 先把数组ARR
// 变成字符串,判断是否包含a 值
System.out.println(b);
// 连接两个 数组;
int[] arr01 = { 0, 1, 2, 3, 4 };
int[] arr02 = { 5, 6, 7, 8, 9 };
//总报错
// int[] combiearr=ArrayUtils.addAll(arr01,arr02);
// method(new String[]{"a", "b", "c", "d", "e"});
String[] stringArray = { "a", "b", "c", "d", "e" };
ArrayList<String> arr_04 = new ArrayList<String>(Arrays
.asList(stringArray));
String[] str_4 = new String[arr_04.size()];
arr_04.toArray(str_4);
int []inarray={1,2,3,4,5,6,7,8,9,};
//翻转 数组;
//ArrayUtils.reverse(inarray);
int []a={1,2,3,4,5,6,7,8,9};
//删除 数组a 中,3号位数字,并且存入 b 中,
//int []b=ArrayUtils.removeElement(a,3);
}
}
|