Java Learning Help Document authoring

Source: Internet
Author: User

On the command line, enter: javadoc-d myhelp (file name)-author (parameter name)-version (parameter name) Arraytool.java (class name)

1 /**2 This is a tool class that can operate on an array, which provides functions such as getting the most value, sorting, and so on. 3 @authorZhang San4 @versionV1.15 6 */7 8  Public classArraytool9 {Ten     /** One Null parameter constructor.  A     */ -     PrivateArraytool () {} -  the     /** - gets the maximum value in a shaped array.  -     @paramarr receives an array of type int.  -     @returnreturns the maximum value in the array.  +     */ -      Public Static intGetmax (int[] arr) +     { A         intMax = 0; at          for(intX=1; x<arr.length; X + +) -         { -             if(arr[x]>Arr[max]) -Max =x; -         } -         returnArr[max]; in     } -      to     /** + gets the minimum value in a shaped array.  -     @paramarr receives an array of type int.  the     @returnreturns a minimum value in the array.  *     */ $      Public Static intGetmin (int[] arr)Panax Notoginseng     { -         intMin = 0; the          for(intX=1; x<arr.length; X + +) +         { A             if(arr[x]<Arr[min]) theMin =x; +         } -         returnArr[min]; $     } $     /** - Select Sort int array.  -     @paramarr receives an array of type int.  the     */ -      Public Static voidSelectsort (int[] arr)Wuyi     { the          for(intx=0; X<arr.length-1; X + + ) -         { Wu              for(inty=x+1; y<arr.length; y++) -             { About                 if(arr[x]>Arr[y]) $                 { - swap (arr,x,y); -                 } -             } A         } +     } the     /** - bubble sort int array.  $     @paramarr receives an array of type int.  the     */ the      Public Static voidBubblesort (int[] arr) the     { the          for(intx=0; X<arr.length-1; X + + ) -         { in              for(inty=0; y<arr.length-x-1; y++) the             { the                 if(arr[y]>arr[y+1]) About                 { theSwap (arr,y,y+1); the                 } the             } +         } -     } the     /**Bayi the permutation of the positions of the elements in the array.  the     @paramarr receives an array of type int.  the     @parama position to displace -     @paramb The position to displace -     */ the     Private  Static voidSwapint[] arr,intAintb) the     { the         inttemp =Arr[a]; theArr[a] =Arr[b]; -ARR[B] =temp; the     } the     /** the used to print the elements in an array. The print form is: [Elemet1, Element2, ...]94     */ the      Public Static voidPrintArray (int[] arr) the     { theSystem.out.print ("[");98          for(intx=0; x<arr.length; X + +) About         { -             if(x!=arr.length-1)101System.out.print (arr[x]+ ",");102             Else103System.out.println (arr[x]+ "]");104         } the     }106}

Java Learning Help Document authoring

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.