Package testwork; </P> <p>/** <br/> * use six numbers: 1, 2, 2, 3, 4, and 5, write a <SPAN class = 'wp _ keywordlink '> Program </span> in Java to print out all the different arrays <br/> * For example, 512234 and 412345. Requirements: "4" cannot be In the third place, "3" and "5" cannot be connected. <Br/> * @ author user <br/> * @ version [version number, jun 29,201 1] <br/> * @ see [related classes/methods] <br/> * @ since [product/module version] <br/> */<br/> Public class test1 <br/>{< br/> private int [] numbers = new int [] {1, 2, 3, 3, 4, 5 };</P> <p> Public int N; </P> <p> private string lastresult = ""; </P> <p> private Boolean validate (string s) <br/>{< br/> If (S. compareto (lastresult) <= 0) // compares two strings alphabetically. <Br/>{< br/> return false; <br/>}< br/> If (S. charat (2) = '4') // "4" cannot be in the third place <br/>{< br/> return false; <br/>}< br/> If (S. indexof ("35")> = 0 | S. indexof ("53")> = 0) // "3" cannot be connected to "5" <br/>{< br/> return false; <br/>}< br/> return true; <br/>}< br/>/** <br/> * <one-sentence function description> <br/> * <function description> <br/> * @ Param Index <br/> * @ Param result [parameter description] <br/> * @ return void [return type description] <br/> * @ exception throws [violation type] [violation description] <br/> * @ see [Class, Class # method, class # member] <br/> */<br/> Public void list (string Index, string result) <br/>{< br/> for (INT I = 0; I <numbers. length; I ++) <br/>{< br/> If (index. indexof (I + 48) <0) <br/>{< br/> string S = Result + String. valueof (numbers [I]); <br/> If (S. length () = numbers. length) <br/>{< br/> If (validate (s) <br/>{< br/> system. out. println (s); <br/> lastresult = s; <br/> N ++; <br/>}< br/> break; <br/>}< br/> List (index + String. valueof (I), S ); <br/>}< br/>/** <br/> * main program portal <br/> * <function description> <br/> * @ Param ARGs [parameter description] <br/> * @ return void [return type description] <br/> * @ exception throws [violation type] [violation description] <br/> * @ see [Class, Class # method, class # member] <br/> */<br/> Public static void main (string [] ARGs) <br/>{< br/> test1 T = new test1 (); <br/> T. list ("", ""); <br/> system. out. println ("Total:" + T. n); <br/>}< br/>