Java learning notes-Arrays, learning notes-arrays

Source: Internet
Author: User

Java learning notes-Arrays, learning notes-arrays
Common Arrays Methods

Arrays. toString (int [] a) method -------> the return type is String, which can be used to generate printable representation of the array. This avoids reading array values cyclically for printing.

Arrays. sort (int [] a) method -------> used to sort Arrays

Arrays. fill (int [] a, int val) method -------> used to fill the array with the val Value

Arrays. copyOfRange (int [] original, int from, int to) method -------> copy an array from the from (inclusive) to (excluded) Location

Arrays. copyOf (int [] original, int newLength) method -------> truncates or expands an array (add 0)

Arrays. binarySearch (int [] a, int key) method -------> Search for a key using the binary method

Arrays. asList (T... a) method -------> converts a continuous object or basic type to List, such as Arrays. adList (,), but in this case, its underlying representation is an array, so the size cannot be adjusted. If you try to use the add () or delete () method to add a delete element, the "Unsupported Operation" error is returned.

 

For more information, see the API documentation.

 

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.