{"id":307686,"date":"2020-07-29T15:00:53","date_gmt":"2020-07-29T15:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307686"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-07-29T15:00:53","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307686","title":{"rendered":"\u0418\u0433\u0440\u0430 \u00ab\u0411\u044b\u043a\u0438 \u0438 \u043a\u043e\u0440\u043e\u0432\u044b\u00bb. \u0427\u0430\u0441\u0442\u044c 1"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512958\/\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041a\u0430\u0440\u0430\u043d\u0442\u0438\u043d \u043f\u0440\u043e\u0448\u0435\u043b \u043f\u043b\u043e\u0434\u043e\u0442\u0432\u043e\u0440\u043d\u043e \u0438 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0433\u0440\u0443\u0448\u043a\u0443 \u0442\u0430\u0439\u043c-\u043a\u0438\u043b\u043b\u0435\u0440 \u00ab\u0411\u044b\u043a\u0438 \u0438 \u043a\u043e\u0440\u043e\u0432\u044b\u00bb. \u0418\u0433\u0440\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u0438\u0433\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 4 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0433\u0430\u0434\u0430\u0442\u044c. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0437\u0430\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0438 4 \u0447\u0438\u0441\u043b\u0430, \u0435\u0441\u043b\u0438 \u0446\u0438\u0444\u0440\u0430 \u0432 \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043a, \u043d\u0443 \u0430 \u0435\u0441\u043b\u0438 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043c\u0435\u0441\u0442\u0435, \u0442\u043e \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0432\u0430. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 BackEnd&#8217;\u043e\u043c, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c FrontEnd, \u043e\u0442\u0433\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0432\u0441\u0435. \u0427\u0442\u043e \u0436, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043b\u0430\u0441\u0441 BackEnd, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"java\">    private int length;             \/\/\u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430     private int[] mas;              \/\/\u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0447\u0438\u0441\u043b\u043e     private int[] inputArray;       \/\/\u0447\u0438\u0441\u043b\u043e, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0443\u043c\u043a\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0447\u0438\u0441\u043b\u043e mas \u0434\u043b\u0438\u043d\u044b length, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0447\u0438\u0441\u043b\u043e inputArray \u0438 \u0432\u0438\u0434\u0438\u0442 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u043c \u0431\u044b\u043a\u043e\u0432 \u0438 \u043a\u043e\u0440\u043e\u0432, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u0431\u0435\u0436\u0434\u0430\u0435\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 mas, \u0447\u0442\u043e \u0431\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0438 \u0434\u0435\u0431\u0430\u0436\u0438\u0442\u044c \u043a\u043e\u0434. \u043f\u043e\u0442\u043e\u043c \u0443\u0431\u0435\u0440\u0435\u043c \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b: <\/p>\n<pre><code class=\"java\">    private void printMas(int[] mas) {         for (int i = 0; i &lt; length; i++) {             System.out.print(mas[i] + &quot;   &quot;);         }     } <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 \u0446\u0438\u043a\u043b for. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u0435, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 mas, \u0430 \u043f\u043e\u0442\u043e\u043c inputArray, \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0447\u0438\u0441\u043b\u0430. \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0432 \u0447\u0438\u0441\u043b\u0435. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e 45566 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442, \u0430 45367 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0437. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0446\u0438\u0444\u0440, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u044f\u0441\u043d\u0438\u043c, \u043a\u0430\u043a\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b \u0447\u0438\u0441\u043b\u043e \u0445\u043e\u0447\u0435\u0442 \u043e\u0442\u0433\u0430\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre><code class=\"java\">private void getMas() {         Scanner scanner = new Scanner(System.in);         do {             System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 1 \u0434\u043e 10&quot;);             while (!scanner.hasNextInt()) {                 System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e&quot;);                 scanner.next();             }             length = scanner.nextInt();         } while (length &lt;= 0 || length &gt; 10);         setMas(createMas());     } <\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 scanner, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0446\u0438\u043a\u043b \u0441 \u043f\u043e\u0441\u0442\u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c do while. \u0427\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a. \u0412 \u0442\u0435\u043b\u0435 \u0446\u0438\u043a\u043b\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0446\u0438\u043a\u043b while. \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0447\u0438\u0441\u043b\u043e, \u0430 \u043d\u0435 \u0434\u0440\u043e\u0431\u044c, \u0431\u0443\u043a\u0432\u044b \u0438 \u0442\u0434. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0447\u0438\u0441\u043b\u043e, \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 length. \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0442\u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c do while \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0443 [0,10). \u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0447\u0438\u0441\u043b\u043e, \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b, \u0442\u043e \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0441\u0438\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u043b\u0438\u043d\u0443. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c createMas \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f mas:<\/p>\n<pre><code class=\"java\"> public void setMas(int[] mas) {         this.mas = mas;     }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"java\">private int[] createMas() {         int[] arr = new int[length];         for (int i = 0; i &lt; this.length; i++) {             arr[i] = (int) (Math.random() * 10);         }         boolean checkMas = false;         while (!checkMas) {             for (int i = 0; i &lt; arr.length; i++) {                 for (int j = 0; j &lt; arr.length; j++) {                     if (i != j) {                         if (arr[i] == arr[j]) {                             arr[j] = (int) (Math.random() * 10);                         }                     }                  }             }               boolean check = false;             for (int i = 0; i &lt; arr.length && !check; i++) {                 for (int j = 0; j &lt; arr.length && !check; j++) {                      if (i != j) {                         if (arr[i] == arr[j]) {                             check = true;                             checkMas = false;                         } else checkMas = true;                     }                 }             }          }         return arr;     }<\/code><\/pre>\n<p>  \u041f\u043e\u044f\u0441\u043d\u044e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b createMas. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u0438\u043d\u044b length \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 [0,10). Math.random() \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 [0,1), \u0430 \u0443\u043c\u043d\u043e\u0436\u0430\u044f \u0435\u0433\u043e \u043d\u0430 10 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 [0,10). \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 arr, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0446\u0438\u0444\u0440. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440 \u0446\u0438\u0444\u0440. \u0414\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0443\u043b\u0435\u0432\u0441\u043a\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0438 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0446\u0438\u0444\u0440. \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u043b \u0435\u0449\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e check. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c. \u0415\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 2 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0438\u0437 for \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f( \u0442\u0430\u043a \u043a\u0430\u043a !check \u0432\u044b\u0434\u0430\u0441\u0442 false \u0438 \u0446\u0438\u043a\u043b\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u0441\u044f), \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u044b for \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f checkMas \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f true \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 arr \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u0435 mas = arr.<\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0447\u0438\u0441\u043b\u043e. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0442\u0433\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 checkInput:<\/p>\n<pre><code class=\"java\">private void checkInput() {         Scanner scanner = new Scanner(System.in);         int[] arr = new int[length];         if (length == 1) System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 &quot; + length + &quot; \u0447\u0438\u0441\u043b\u043e \u0447\u0435\u0440\u0435\u0437 \u0432\u0432\u043e\u0434&quot;);         else {             if (length &gt; 1 && length &lt; 5) {                 System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 &quot; + length + &quot; \u0447\u0438\u0441\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u0432\u043e\u0434&quot;);             } else {                 if (length &gt; 4 && length &lt; 11) {                     System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 &quot; + length + &quot; \u0447\u0438\u0441\u0435\u043b \u0447\u0435\u0440\u0435\u0437 \u0432\u0432\u043e\u0434&quot;);                 }             }         }         boolean checkMas = false;         while (!checkMas) {             for (int i = 0; i &lt; length; i++) {                 do {                     System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e&quot;);                     while (!scanner.hasNextInt()) {                         System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e&quot;);                         scanner.next();                     }                     arr[i] = scanner.nextInt();                     if(arr[i] &lt; 0 || arr[i]&gt;=10) System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 9 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e&quot;);                 } while (arr[i] &lt; 0 || arr[i] &gt;= 10);             }                          boolean check = checkInputArray(arr);             if (check) {                 checkMas = true;             } else {                 System.out.println(&quot;\u0412\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0447\u0438\u0441\u043b\u0430&quot;);                 System.out.println(&quot;\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u0432\u0432\u043e\u0434 \u0441\u043d\u0430\u0447\u0430\u043b\u0430&quot;);             }         }         setInputArray(arr);      }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c scanner \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 arr \u0434\u043b\u0438\u043d\u044b length. \u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0435\u0442 \u043f\u0430\u0447\u043a\u0430 if&#8217;\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438 \u0444\u0440\u0430\u0437\u044b. \u041f\u043e\u0441\u043b\u0435 \u043d\u0438\u0445 \u0438\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0432\u043e\u0434 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u0430\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u0432 \u043b\u043e\u0433\u0438\u043a\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u043b \u043a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. <\/p>\n<pre><code class=\"java\">for (int i = 0; i &lt; length; i++) {                 do {                     System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e&quot;);                     while (!scanner.hasNextInt()) {                         System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e&quot;);                         scanner.next();                     }                     arr[i] = scanner.nextInt();                     if(arr[i] &lt; 0 || arr[i]&gt;=10) System.out.println(&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 9 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e&quot;);                 } while (arr[i] &lt; 0 || arr[i] &gt;= 10);             }<\/code><\/pre>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0443\u0447\u0430\u0441\u0442\u043a\u0435 \u043a\u043e\u0434\u0430 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e. \u0420\u0430\u0431\u043e\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u0432\u0432\u043e\u0434\u0443 \u0434\u043b\u0438\u043d\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0432\u0438\u0436\u0443. \u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 checkInputArray:<\/p>\n<pre><code class=\"java\">private boolean checkInputArray(int[] arr) {         boolean checkMas = false;         boolean check = false;         for (int i = 0; i &lt; arr.length && !check; i++) {             for (int j = 0; j &lt; arr.length && !check; j++) {                  if (i != j) {                     if (arr[i] == arr[j]) {                         check = true;                         checkMas = false;                     } else checkMas = true;                 }             }         }         return checkMas;     }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0430\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0439. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0446\u0438\u0444\u0440\u044b, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043d\u043e\u0432\u043e. \u0418 \u0442\u0430\u043a \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f inputArray \u043d\u0430 \u043d\u0430\u0448 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 arr. \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"java\">public void setInputArray(int[] inputArray) {         this.inputArray = inputArray;     }<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430: \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u0431\u044b\u043a\u043e\u0432 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043e\u0432 \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<p>  \u0423\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 checkCowAndBull:<\/p>\n<pre><code class=\"java\">private int[] checkCowAndBull() {         int[] arr = new int[2];         int cow = 0;         int bull = 0;         for (int i = 0; i &lt; length; i++) {             for (int j = 0; j &lt; length; j++) {                  if (mas[i] == inputArray[j]) {                     if (i == j) bull++;                     else cow++;                 }             }         }         arr[0] = cow;         arr[1] = bull;         return arr;     }<\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0440\u043e\u0432, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u044b\u043a\u043e\u0432. \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0432\u043d\u044b \u0438 \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0440\u0430\u0432\u043d\u044b, \u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u044b\u043a\u043e\u0432, \u0438\u043d\u0430\u0447\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0440\u043e\u0432. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e.<\/p>\n<p>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0436\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 BackEnd.<\/p>\n<pre><code class=\"java\">public BackEnd() {         getMas();         \/\/printMas(mas);         boolean win = false;         while (!win) {             checkInput();             System.out.println(&quot;\u0412\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432:&quot;);             printMas(inputArray);             System.out.println();             int[] arr = checkCowAndBull();             if (arr[1] == length) {                 win = true;                 System.out.println(&quot;\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e! \u0412\u044b \u043f\u043e\u0431\u0435\u0434\u0438\u043b\u0438!&quot;);             } else {                 System.out.println(&quot;\u0412 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435 &quot; + arr[0] + &quot; \u043a\u043e\u0440\u043e\u0432, &quot; + arr[1] + &quot; \u0431\u044b\u043a\u043e\u0432&quot;);                 System.out.println(&quot;\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u0432\u0432\u043e\u0434 \u0447\u0438\u0441\u043b\u0430&quot;);             }         }     }<\/code><\/pre>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u044f \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043b, \u043d\u043e \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0433\u0430\u0434\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0446\u0438\u043a\u043b while \u0434\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430. \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0447\u0438\u0441\u043b\u043e, \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u044b\u043a\u043e\u0432 \u0438 \u043a\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u044b\u043a\u043e\u0432 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0442\u043e \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u0433\u0430\u0434\u0430\u043d\u043e \u0438 \u0438\u0433\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e \u0431\u044b\u043a\u043e\u0432 \u0438 \u043a\u043e\u0440\u043e\u0432 \u0438 \u0438\u0433\u0440\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 man \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430: <\/p>\n<pre><code class=\"java\">public class main {     public static void main(String[] args) {         BackEnd bk = new BackEnd();     } }<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0438\u0433\u0440\u0430\u0435\u043c.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0441\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/512958\/\"> https:\/\/habr.com\/ru\/post\/512958\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512958\/\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041a\u0430\u0440\u0430\u043d\u0442\u0438\u043d \u043f\u0440\u043e\u0448\u0435\u043b \u043f\u043b\u043e\u0434\u043e\u0442\u0432\u043e\u0440\u043d\u043e \u0438 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0433\u0440\u0443\u0448\u043a\u0443 \u0442\u0430\u0439\u043c-\u043a\u0438\u043b\u043b\u0435\u0440 \u00ab\u0411\u044b\u043a\u0438 \u0438 \u043a\u043e\u0440\u043e\u0432\u044b\u00bb. \u0418\u0433\u0440\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u0438\u0433\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 4 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0433\u0430\u0434\u0430\u0442\u044c. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0437\u0430\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0438 4 \u0447\u0438\u0441\u043b\u0430, \u0435\u0441\u043b\u0438 \u0446\u0438\u0444\u0440\u0430 \u0432 \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439, \u0432 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043a, \u043d\u0443 \u0430 \u0435\u0441\u043b\u0438 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043c\u0435\u0441\u0442\u0435, \u0442\u043e \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0432\u0430. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 BackEnd&#8217;\u043e\u043c, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c FrontEnd, \u043e\u0442\u0433\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0432\u0441\u0435. \u0427\u0442\u043e \u0436, \u043d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043b\u0430\u0441\u0441 BackEnd, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"java\">    private int length;             \/\/\u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430     private int[] mas;              \/\/\u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0447\u0438\u0441\u043b\u043e     private int[] inputArray;       \/\/\u0447\u0438\u0441\u043b\u043e, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0443\u043c\u043a\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0447\u0438\u0441\u043b\u043e mas \u0434\u043b\u0438\u043d\u044b length, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0447\u0438\u0441\u043b\u043e inputArray \u0438 \u0432\u0438\u0434\u0438\u0442 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u043c \u0431\u044b\u043a\u043e\u0432 \u0438 \u043a\u043e\u0440\u043e\u0432, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u0431\u0435\u0436\u0434\u0430\u0435\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 mas, \u0447\u0442\u043e \u0431\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0438 \u0434\u0435\u0431\u0430\u0436\u0438\u0442\u044c \u043a\u043e\u0434. \u043f\u043e\u0442\u043e\u043c \u0443\u0431\u0435\u0440\u0435\u043c \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b: <\/p>\n<pre><code class=\"java\">    private void printMas(int[] mas) {         for (int i = 0; i &lt; length; i++) {             System.out.print(mas[i] + &quot;   &quot;);         }     } <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 \u0446\u0438\u043a\u043b for. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u0435, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 mas, \u0430 \u043f\u043e\u0442\u043e\u043c inputArray, \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-307686","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307686"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307686\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}