Javadoc Simple Array Tool class documentation (API)

Source: Internet
Author: User

Make a simple Array tool class document (API)
How to create a document
Take the Array tool Class (array) as an example
Create an array tool class
Requires implementation (1) iterating the array (2) to find the maximum value in the array (3) The first occurrence of an element in an array (4) flips and traverses the array elements
/**
* This is a tool class for arrays
* @author Apple
* @version V1.0
* */
public class array{
Private Array () {//non-parametric construction is privatized and cannot be instantiated
}

/** traversing an array
* @param arr: array that needs to be traversed
*/
public static void Blarray (int[] arr) {//uses the static modifier to load as the class is loaded so that it can be called directly with the class name;
for (int i = 0;i < arr.length;i++) {
System.out.print (Arr[i] + "\ t");
}
}

/**
* Find the maximum value in the array
* @param arr: array that needs to be queried
* @return Return the maximum value we are looking for
* */
public static int Maxarray (int[] arr) {
int max = arr[0];
for (int i = 0;i < arr.length;i++) {
if (Max < arr[i]) {
max = Arr[i];
}
}
return Max;
}

/**
* Query the array for the first occurrence of the elements in the array index, if not found, return 1
* @param arr: need to query singular groups
* @param value: A single element needs to be queried
* @return: Returns the value of the index for the first occurrence of the element in the array
* */
public static int Syarray (int[] arr,int value) {
int wz =-1;
for (int i = 0;i < arr.length;i++) {
if (value = = Arr[i]) {
WZ = i;
Break
}
}
return wz;
}

/** flipping and iterating through an array
* @param arr: An array that needs to be flipped through
*/
public static void Fzarray (int[] arr) {
int[] arr1 = new Int[arr.length];
for (int i = 0;i < arr.length;i++) {
Arr1[arr.length-1-I] = arr[i];
}
for (int x = 0;x < arr1.length;x++) {
System.out.print (arr1[x] + "\ t");
}
}
}
two. Testing
Test whether the Array tool class feature is available
public class arraytest{
public static void Main (String[]ages) {
Int[] arr = {212,34,45,2,6,24,2,73,24};
Array traversal
Array.blarray (arr);
To find the largest value in an array
int i = Array.maxarray (arr);
SYSTEM.OUT.PRINTLN ("Maximum value is:" + i);
The index of the first occurrence of the 24 element in the array
Int J = Array.syarray (arr,24);
System.out.println ("24 first appears in" + j + "position");
Traversing an array of flips
Array.fzarray (arr);
}
}
Iii. Documentation (API) Generation
Start cmd
javadoc-d directory (the directory where the Array.java file resides)-author-version Array.java

650) this.width=650; "title=" QQ picture 20170715191829.png "style=" Float:none; "src=" https://s2.51cto.com/wyfs02/M02/9B/ Fd/wkiol1lp-l6h9emgaadtkudse68458.png "alt=" Wkiol1lp-l6h9emgaadtkudse68458.png "/>

650) this.width=650; "title=" QQ picture 20170715191900.png "style=" Float:none; "src=" https://s2.51cto.com/wyfs02/M00/9B/ Fd/wkiom1lp-l6td8j1aaccbgsvicw025.png "alt=" Wkiom1lp-l6td8j1aaccbgsvicw025.png "/>


Javadoc Simple Array Tool class documentation (API)

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.