Java's Arrays Class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.