1.Arrays class overview
A tool class that operates on an array.
Provides functions such as sorting, finding and so on.
2. Member Methods
public static String toString (int[] a)
public static void sort (int[] a)
public static int BinarySearch (int[] a,int value)
Package com;import java.util.arrays;/** * arrays class overview and Common methods * tool classes for manipulating arrays. * provides functions such as sorting, finding and so on. * member Method * public static string tostring (int[] a) Converts an array of type int to a string * public static void sort (int[] a) Sort the array, using a quick sort in the interior * Public static int binarysearch (int[] a,int key) binary search * @author Hu Weiwei * */public class arraysdemo {public static void main (String[] args) {int[] array = {3,44,2,546,74};//public static string tostring ( Int[] a) Converts an array of type int to a string System.out.println (arrays.tostring (array));//[3, 44, 2, 546, 74]//public static void sort (int[] a) array sorting, internally using a quick sort arrays.sort (array); System.out.println (arrays.tostring (array));//[2, 3, 44, 74, 546]//public static Int&nbsP;binarysearch (int[] a,int key) Binary lookup method Int index = arrays.binarysearch (array,  5); SYSTEM.OUT.PRINTLN (index);//-3}}
This article is from the "11831428" blog, please be sure to keep this source http://11841428.blog.51cto.com/11831428/1861227
Java's Arrays Class