package ru.job4j.array;

/**
 * Class for filling in a massive with squared numbers.
 *
 * @author Dmitrii Eskov (eskovdmi@gmail.com)
 * @version 1.0
 * @since 14.11.2018
 */
public class Square {

    /**
     * Filling in a massive with squared numbers.
     * @param bound argument
     * @return rst (massive with the result)
     */
    public int[] calculate(int bound) {
        int[] rst = new int[bound];
        int result = 1;
        for (int rstNew : rst) {
            rstNew = (int) Math.pow(result, 2);
            rst[result - 1] = rstNew;
            ++result;
        }
        return rst;
    }
}
@@ -419,104 +419,42 @@
     
-int result = 1;%0A        for (int rstNew : rst) %7B%0A            rstNew = (int) Math.pow(result, 2);
+for (int i = 1; i %3C= bound; i++) %7B
 %0A   
@@ -470,22 +470,17 @@
 rst%5B
-result
+i
  - 1%5D = 
 rstN
@@ -479,36 +479,13 @@
 %5D = 
-rstNew;%0A            ++result
+i * i
 ;%0A  

6.0. Filling in an array with squared numbers