Lauren Green 6 年 前
コミット
49cd513b39
共有5 個のファイルを変更した301 個の追加84 個の削除を含む
  1. 79
    61
      .idea/workspace.xml
  2. 62
    0
      arraz/src/main/java/Arraz.java
  3. 0
    11
      arraz/src/main/java/MaxMin.java
  4. 0
    12
      arraz/src/main/java/OddEven.java
  5. 160
    0
      arraz/src/test/java/ArrazTest.java

+ 79
- 61
.idea/workspace.xml ファイルの表示

@@ -2,9 +2,6 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8 5
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
9 6
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
10 7
     </list>
@@ -15,6 +12,9 @@
15 12
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
16 13
     <option name="LAST_RESOLUTION" value="IGNORE" />
17 14
   </component>
15
+  <component name="CoverageDataManager">
16
+    <SUITE FILE_PATH="coverage/ArraysGoneWild$All_in_arraz.ic" NAME="All in arraz Coverage Results" MODIFIED="1544032699038" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
17
+  </component>
18 18
   <component name="FUSProjectUsageTrigger">
19 19
     <session id="1944976257">
20 20
       <usages-collector id="statistics.lifecycle.project">
@@ -37,12 +37,12 @@
37 37
       </usages-collector>
38 38
       <usages-collector id="statistics.file.extensions.edit">
39 39
         <counts>
40
-          <entry key="java" value="4279" />
40
+          <entry key="java" value="5252" />
41 41
         </counts>
42 42
       </usages-collector>
43 43
       <usages-collector id="statistics.file.types.edit">
44 44
         <counts>
45
-          <entry key="JAVA" value="4279" />
45
+          <entry key="JAVA" value="5252" />
46 46
         </counts>
47 47
       </usages-collector>
48 48
     </session>
@@ -59,14 +59,24 @@
59 59
           <file pinned="false" current-in-tab="false">
60 60
             <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
61 61
               <provider selected="true" editor-type-id="text-editor">
62
-                <state relative-caret-position="459">
63
-                  <caret line="216" column="40" selection-start-line="216" selection-start-column="40" selection-end-line="216" selection-end-column="40" />
62
+                <state relative-caret-position="476">
63
+                  <caret line="278" column="22" selection-start-line="278" selection-start-column="22" selection-end-line="278" selection-end-column="22" />
64 64
                   <folding>
65 65
                     <element signature="e#415#416#0" expanded="true" />
66 66
                     <element signature="e#475#476#0" expanded="true" />
67 67
                     <element signature="e#541#542#0" expanded="true" />
68 68
                     <element signature="e#602#603#0" expanded="true" />
69 69
                     <element signature="e#4244#4253#0" expanded="true" />
70
+                    <element signature="e#5874#5875#0" expanded="true" />
71
+                    <element signature="e#5910#5911#0" expanded="true" />
72
+                    <element signature="e#5971#5972#0" expanded="true" />
73
+                    <element signature="e#6017#6018#0" expanded="true" />
74
+                    <element signature="e#6104#6105#0" expanded="true" />
75
+                    <element signature="e#6150#6151#0" expanded="true" />
76
+                    <element signature="e#6230#6231#0" expanded="true" />
77
+                    <element signature="e#6271#6272#0" expanded="true" />
78
+                    <element signature="e#6348#6349#0" expanded="true" />
79
+                    <element signature="e#6369#6370#0" expanded="true" />
70 80
                   </folding>
71 81
                 </state>
72 82
               </provider>
@@ -75,8 +85,8 @@
75 85
           <file pinned="false" current-in-tab="true">
76 86
             <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
77 87
               <provider selected="true" editor-type-id="text-editor">
78
-                <state relative-caret-position="373">
79
-                  <caret line="413" column="31" lean-forward="true" selection-start-line="413" selection-start-column="31" selection-end-line="413" selection-end-column="31" />
88
+                <state relative-caret-position="328">
89
+                  <caret line="570" column="39" selection-start-line="570" selection-start-column="39" selection-end-line="570" selection-end-column="39" />
80 90
                   <folding>
81 91
                     <element signature="imports" expanded="true" />
82 92
                     <element signature="e#8652#8661#0" expanded="true" />
@@ -132,8 +142,8 @@
132 142
         <option value="$PROJECT_DIR$/README.md" />
133 143
         <option value="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" />
134 144
         <option value="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" />
135
-        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
136 145
         <option value="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" />
146
+        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
137 147
       </list>
138 148
     </option>
139 149
   </component>
@@ -226,7 +236,7 @@
226 236
     <property name="GO_FMT" value="false" />
227 237
     <property name="WebServerToolWindowFactoryState" value="false" />
228 238
     <property name="aspect.path.notification.shown" value="true" />
229
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544030017355" />
239
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544032698580" />
230 240
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
231 241
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
232 242
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -253,7 +263,7 @@
253 263
       </list>
254 264
     </option>
255 265
   </component>
256
-  <component name="RunManager" selected="JUnit.ArrazTest.test2averageWOMaxMin">
266
+  <component name="RunManager" selected="JUnit.All in arraz">
257 267
     <configuration default="true" type="Applet" factoryName="Applet">
258 268
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
259 269
       <method v="2">
@@ -266,55 +276,53 @@
266 276
         <option name="Make" enabled="true" />
267 277
       </method>
268 278
     </configuration>
269
-    <configuration name="ArrazTest.test1averageWOMaxMin" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
279
+    <configuration name="All in arraz" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
270 280
       <module name="arraz" />
271 281
       <option name="PACKAGE_NAME" value="" />
272
-      <option name="MAIN_CLASS_NAME" value="ArrazTest" />
273
-      <option name="METHOD_NAME" value="test1averageWOMaxMin" />
274
-      <option name="TEST_OBJECT" value="method" />
282
+      <option name="TEST_OBJECT" value="package" />
275 283
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
276 284
       <method v="2">
277 285
         <option name="Make" enabled="true" />
278 286
       </method>
279 287
     </configuration>
280
-    <configuration name="ArrazTest.test1check2ArraysEqual" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
288
+    <configuration name="ArrazTest.test1insertAtEnd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
281 289
       <module name="arraz" />
282 290
       <option name="PACKAGE_NAME" value="" />
283 291
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
284
-      <option name="METHOD_NAME" value="test1check2ArraysEqual" />
292
+      <option name="METHOD_NAME" value="test1insertAtEnd" />
285 293
       <option name="TEST_OBJECT" value="method" />
286 294
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
287 295
       <method v="2">
288 296
         <option name="Make" enabled="true" />
289 297
       </method>
290 298
     </configuration>
291
-    <configuration name="ArrazTest.test2ArrayFromList" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
299
+    <configuration name="ArrazTest.test1sortEvenOdd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
292 300
       <module name="arraz" />
293 301
       <option name="PACKAGE_NAME" value="" />
294 302
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
295
-      <option name="METHOD_NAME" value="test2ArrayFromList" />
303
+      <option name="METHOD_NAME" value="test1sortEvenOdd" />
296 304
       <option name="TEST_OBJECT" value="method" />
297 305
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
298 306
       <method v="2">
299 307
         <option name="Make" enabled="true" />
300 308
       </method>
301 309
     </configuration>
302
-    <configuration name="ArrazTest.test2averageWOMaxMin" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
310
+    <configuration name="ArrazTest.test2insertIAtEnd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
303 311
       <module name="arraz" />
304 312
       <option name="PACKAGE_NAME" value="" />
305 313
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
306
-      <option name="METHOD_NAME" value="test2averageWOMaxMin" />
314
+      <option name="METHOD_NAME" value="test2insertIAtEnd" />
307 315
       <option name="TEST_OBJECT" value="method" />
308 316
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
309 317
       <method v="2">
310 318
         <option name="Make" enabled="true" />
311 319
       </method>
312 320
     </configuration>
313
-    <configuration name="ArrazTest.test2check2ArraysEqual" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
321
+    <configuration name="ArrazTest.test2sortEvenOdd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
314 322
       <module name="arraz" />
315 323
       <option name="PACKAGE_NAME" value="" />
316 324
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
317
-      <option name="METHOD_NAME" value="test2check2ArraysEqual" />
325
+      <option name="METHOD_NAME" value="test2sortEvenOdd" />
318 326
       <option name="TEST_OBJECT" value="method" />
319 327
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
320 328
       <method v="2">
@@ -345,19 +353,19 @@
345 353
       </method>
346 354
     </configuration>
347 355
     <list>
348
-      <item itemvalue="JUnit.ArrazTest.test2ArrayFromList" />
349
-      <item itemvalue="JUnit.ArrazTest.test1check2ArraysEqual" />
350
-      <item itemvalue="JUnit.ArrazTest.test2check2ArraysEqual" />
351
-      <item itemvalue="JUnit.ArrazTest.test1averageWOMaxMin" />
352
-      <item itemvalue="JUnit.ArrazTest.test2averageWOMaxMin" />
356
+      <item itemvalue="JUnit.ArrazTest.test1insertAtEnd" />
357
+      <item itemvalue="JUnit.ArrazTest.test2insertIAtEnd" />
358
+      <item itemvalue="JUnit.ArrazTest.test1sortEvenOdd" />
359
+      <item itemvalue="JUnit.ArrazTest.test2sortEvenOdd" />
360
+      <item itemvalue="JUnit.All in arraz" />
353 361
     </list>
354 362
     <recent_temporary>
355 363
       <list>
356
-        <item itemvalue="JUnit.ArrazTest.test2averageWOMaxMin" />
357
-        <item itemvalue="JUnit.ArrazTest.test1averageWOMaxMin" />
358
-        <item itemvalue="JUnit.ArrazTest.test2check2ArraysEqual" />
359
-        <item itemvalue="JUnit.ArrazTest.test1check2ArraysEqual" />
360
-        <item itemvalue="JUnit.ArrazTest.test2ArrayFromList" />
364
+        <item itemvalue="JUnit.All in arraz" />
365
+        <item itemvalue="JUnit.ArrazTest.test1sortEvenOdd" />
366
+        <item itemvalue="JUnit.ArrazTest.test2sortEvenOdd" />
367
+        <item itemvalue="JUnit.ArrazTest.test2insertIAtEnd" />
368
+        <item itemvalue="JUnit.ArrazTest.test1insertAtEnd" />
361 369
       </list>
362 370
     </recent_temporary>
363 371
   </component>
@@ -374,7 +382,7 @@
374 382
       <workItem from="1543955862749" duration="2347000" />
375 383
       <workItem from="1543958998826" duration="113000" />
376 384
       <workItem from="1544020724645" duration="762000" />
377
-      <workItem from="1544021986078" duration="7134000" />
385
+      <workItem from="1544021986078" duration="9223000" />
378 386
     </task>
379 387
     <task id="LOCAL-00001" summary="readme and docs">
380 388
       <created>1544021313039</created>
@@ -387,39 +395,39 @@
387 395
     <servers />
388 396
   </component>
389 397
   <component name="TestHistory">
390
-    <history-entry file="ArrazTest_test1removeDups - 2018.12.05 at 11h 50m 29s.xml">
391
-      <configuration name="ArrazTest.test1removeDups" configurationId="JUnit" />
398
+    <history-entry file="ArrazTest_test1removeLastItem - 2018.12.05 at 12h 47m 54s.xml">
399
+      <configuration name="ArrazTest.test1removeLastItem" configurationId="JUnit" />
392 400
     </history-entry>
393
-    <history-entry file="ArrazTest_test2removeDups - 2018.12.05 at 11h 50m 32s.xml">
394
-      <configuration name="ArrazTest.test2removeDups" configurationId="JUnit" />
401
+    <history-entry file="ArrazTest_test2removeLastItem - 2018.12.05 at 12h 47m 57s.xml">
402
+      <configuration name="ArrazTest.test2removeLastItem" configurationId="JUnit" />
395 403
     </history-entry>
396
-    <history-entry file="ArrazTest_test1find2ndLargest - 2018.12.05 at 11h 54m 08s.xml">
397
-      <configuration name="ArrazTest.test1find2ndLargest" configurationId="JUnit" />
404
+    <history-entry file="ArrazTest_test1removeFirstItem - 2018.12.05 at 12h 49m 11s.xml">
405
+      <configuration name="ArrazTest.test1removeFirstItem" configurationId="JUnit" />
398 406
     </history-entry>
399
-    <history-entry file="ArrazTest_test2find2ndLargest - 2018.12.05 at 11h 54m 12s.xml">
400
-      <configuration name="ArrazTest.test2find2ndLargest" configurationId="JUnit" />
407
+    <history-entry file="ArrazTest_test2removeFirstItem - 2018.12.05 at 12h 49m 14s.xml">
408
+      <configuration name="ArrazTest.test2removeFirstItem" configurationId="JUnit" />
401 409
     </history-entry>
402
-    <history-entry file="ArrazTest_test1listFromArray - 2018.12.05 at 11h 57m 18s.xml">
403
-      <configuration name="ArrazTest.test1listFromArray" configurationId="JUnit" />
410
+    <history-entry file="ArrazTest_test1insertAtStart - 2018.12.05 at 12h 51m 36s.xml">
411
+      <configuration name="ArrazTest.test1insertAtStart" configurationId="JUnit" />
404 412
     </history-entry>
405
-    <history-entry file="ArrazTest_test2ListFromArray - 2018.12.05 at 11h 57m 20s.xml">
406
-      <configuration name="ArrazTest.test2ListFromArray" configurationId="JUnit" />
413
+    <history-entry file="ArrazTest_test2insertIAtStart - 2018.12.05 at 12h 51m 40s.xml">
414
+      <configuration name="ArrazTest.test2insertIAtStart" configurationId="JUnit" />
407 415
     </history-entry>
408
-    <history-entry file="ArrazTest_test1ArrayFromList - 2018.12.05 at 12h 00m 53s.xml">
409
-      <configuration name="ArrazTest.test1ArrayFromList" configurationId="JUnit" />
416
+    <history-entry file="ArrazTest_test1insertAtEnd - 2018.12.05 at 12h 52m 31s.xml">
417
+      <configuration name="ArrazTest.test1insertAtEnd" configurationId="JUnit" />
410 418
     </history-entry>
411
-    <history-entry file="ArrazTest_test2ArrayFromList - 2018.12.05 at 12h 00m 57s.xml">
412
-      <configuration name="ArrazTest.test2ArrayFromList" configurationId="JUnit" />
419
+    <history-entry file="ArrazTest_test2insertIAtEnd - 2018.12.05 at 12h 52m 37s.xml">
420
+      <configuration name="ArrazTest.test2insertIAtEnd" configurationId="JUnit" />
413 421
     </history-entry>
414
-    <history-entry file="ArrazTest_test1check2ArraysEqual - 2018.12.05 at 12h 05m 49s.xml">
415
-      <configuration name="ArrazTest.test1check2ArraysEqual" configurationId="JUnit" />
422
+    <history-entry file="ArrazTest_test1insertAtEnd - 2018.12.05 at 12h 52m 57s.xml">
423
+      <configuration name="ArrazTest.test1insertAtEnd" configurationId="JUnit" />
416 424
     </history-entry>
417
-    <history-entry file="ArrazTest_test2check2ArraysEqual - 2018.12.05 at 12h 05m 52s.xml">
418
-      <configuration name="ArrazTest.test2check2ArraysEqual" configurationId="JUnit" />
425
+    <history-entry file="ArrazTest_test2insertIAtEnd - 2018.12.05 at 12h 53m 01s.xml">
426
+      <configuration name="ArrazTest.test2insertIAtEnd" configurationId="JUnit" />
419 427
     </history-entry>
420 428
   </component>
421 429
   <component name="TimeTrackingManager">
422
-    <option name="totallyTimeSpent" value="10356000" />
430
+    <option name="totallyTimeSpent" value="12445000" />
423 431
   </component>
424 432
   <component name="ToolWindowManager">
425 433
     <frame x="-209" y="-1057" width="1517" height="959" extended-state="0" />
@@ -441,7 +449,7 @@
441 449
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
442 450
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
443 451
       <window_info anchor="bottom" id="TODO" order="6" />
444
-      <window_info anchor="bottom" id="Terminal" order="7" />
452
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.3298731" />
445 453
       <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
446 454
       <window_info anchor="bottom" id="Version Control" order="9" />
447 455
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
@@ -505,22 +513,32 @@
505 513
     </entry>
506 514
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
507 515
       <provider selected="true" editor-type-id="text-editor">
508
-        <state relative-caret-position="459">
509
-          <caret line="216" column="40" selection-start-line="216" selection-start-column="40" selection-end-line="216" selection-end-column="40" />
516
+        <state relative-caret-position="476">
517
+          <caret line="278" column="22" selection-start-line="278" selection-start-column="22" selection-end-line="278" selection-end-column="22" />
510 518
           <folding>
511 519
             <element signature="e#415#416#0" expanded="true" />
512 520
             <element signature="e#475#476#0" expanded="true" />
513 521
             <element signature="e#541#542#0" expanded="true" />
514 522
             <element signature="e#602#603#0" expanded="true" />
515 523
             <element signature="e#4244#4253#0" expanded="true" />
524
+            <element signature="e#5874#5875#0" expanded="true" />
525
+            <element signature="e#5910#5911#0" expanded="true" />
526
+            <element signature="e#5971#5972#0" expanded="true" />
527
+            <element signature="e#6017#6018#0" expanded="true" />
528
+            <element signature="e#6104#6105#0" expanded="true" />
529
+            <element signature="e#6150#6151#0" expanded="true" />
530
+            <element signature="e#6230#6231#0" expanded="true" />
531
+            <element signature="e#6271#6272#0" expanded="true" />
532
+            <element signature="e#6348#6349#0" expanded="true" />
533
+            <element signature="e#6369#6370#0" expanded="true" />
516 534
           </folding>
517 535
         </state>
518 536
       </provider>
519 537
     </entry>
520 538
     <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
521 539
       <provider selected="true" editor-type-id="text-editor">
522
-        <state relative-caret-position="373">
523
-          <caret line="413" column="31" lean-forward="true" selection-start-line="413" selection-start-column="31" selection-end-line="413" selection-end-column="31" />
540
+        <state relative-caret-position="328">
541
+          <caret line="570" column="39" selection-start-line="570" selection-start-column="39" selection-end-line="570" selection-end-column="39" />
524 542
           <folding>
525 543
             <element signature="imports" expanded="true" />
526 544
             <element signature="e#8652#8661#0" expanded="true" />

+ 62
- 0
arraz/src/main/java/Arraz.java ファイルの表示

@@ -216,4 +216,66 @@ public class Arraz {
216 216
         int[] noMaxMin = removeElementFromArray(noMax, min);
217 217
         return averageOfArray(noMaxMin);
218 218
     }
219
+
220
+    public static boolean arrayHas65and77(int[] input) {
221
+
222
+        return (containsValue(input, 65) && containsValue(input,77));
223
+    }
224
+
225
+    public static boolean totalOfTensIs30(int[] input) {
226
+
227
+        int count = 0;
228
+
229
+        for(int i: input) {
230
+            if(i == 10)
231
+            count++;
232
+        }
233
+        if(count == 3)
234
+            return true;
235
+
236
+        return false;
237
+    }
238
+
239
+    public static int find2ndSmallestValueFromArray(int[] input) {
240
+
241
+        int min = findMaxMinOfArray(input).getMin();
242
+        int[] noMin = removeElementFromArray(input, min);
243
+        return findMaxMinOfArray(noMin).getMin();
244
+    }
245
+
246
+    public static int[] reverseCopyOfArray(int[] input) {
247
+        return reverseArray(input);
248
+    }
249
+
250
+    public static int[] removeLastItem(int[] input) {
251
+        return removeElementFromArray(input, input[input.length - 1]);
252
+    }
253
+
254
+    public static int[] removeFirstItem(int[] input) {
255
+        return removeElementFromArray(input, input[0]);
256
+    }
257
+
258
+    public static int[] insertAtStart(int[] input, int numb) {
259
+        return insertIntoArrayAt(input, numb, 0);
260
+    }
261
+
262
+    public static int[] insertAtEnd(int[] input, int numb) {
263
+        return insertIntoArrayAt(input, numb, input.length);
264
+    }
265
+
266
+    public static int[] sortArrayIntoEvensThenOdds(int[] input) {
267
+        int[] output = new int[input.length];
268
+        int frontIndex = 0;
269
+        int backIndex = input.length - 1;
270
+        for (int i : input) {
271
+            if(i % 2 == 0) {
272
+                output[frontIndex] = i;
273
+                frontIndex++;
274
+            } else {
275
+                output[backIndex] = i;
276
+                backIndex--;
277
+            }
278
+        }
279
+        return output;
280
+    }
219 281
 }

+ 0
- 11
arraz/src/main/java/MaxMin.java ファイルの表示

@@ -2,9 +2,6 @@ public class MaxMin{
2 2
     public int max;
3 3
     public int min;
4 4
 
5
-    public MaxMin() {
6
-    }
7
-
8 5
     public MaxMin(int max, int min) {
9 6
         this.max = max;
10 7
         this.min = min;
@@ -14,18 +11,10 @@ public class MaxMin{
14 11
         return max;
15 12
     }
16 13
 
17
-    public void setMax(int max) {
18
-        this.max = max;
19
-    }
20
-
21 14
     public int getMin() {
22 15
         return min;
23 16
     }
24 17
 
25
-    public void setMin(int min) {
26
-        this.min = min;
27
-    }
28
-
29 18
     @Override
30 19
     public boolean equals(Object o){
31 20
         MaxMin maxMin = (MaxMin) o;

+ 0
- 12
arraz/src/main/java/OddEven.java ファイルの表示

@@ -3,10 +3,6 @@ public class OddEven{
3 3
     public int odds;
4 4
     public int evens;
5 5
 
6
-    public OddEven() {
7
-        new OddEven(0, 0);
8
-    }
9
-
10 6
     public OddEven(int odds, int evens) {
11 7
         this.odds = odds;
12 8
         this.evens = evens;
@@ -16,18 +12,10 @@ public class OddEven{
16 12
         return odds;
17 13
     }
18 14
 
19
-    public void setOdds(int odds) {
20
-        this.odds = odds;
21
-    }
22
-
23 15
     public int getEvens() {
24 16
         return evens;
25 17
     }
26 18
 
27
-    public void setEvens(int evens) {
28
-        this.evens = evens;
29
-    }
30
-
31 19
     @Override
32 20
     public boolean equals(Object o){
33 21
         OddEven oddEven = (OddEven) o;

+ 160
- 0
arraz/src/test/java/ArrazTest.java ファイルの表示

@@ -416,4 +416,164 @@ public class ArrazTest {
416 416
         assertEquals(expected, actual);
417 417
     }
418 418
 
419
+    @Test
420
+    public void test1arrayHas65and77() {
421
+        int[] input = {3, 4, 9, 2, 1};
422
+
423
+        assertFalse(Arraz.arrayHas65and77(input));
424
+    }
425
+
426
+    @Test
427
+    public void test2arrayHas65and77() {
428
+        int[] input = {8, 2, 3, 65, 77, 1, 9};
429
+
430
+        assertTrue(Arraz.arrayHas65and77(input));
431
+    }
432
+
433
+    @Test
434
+    public void test1tensTotal30() {
435
+        int[] input = {3, 4, 9, 2, 10};
436
+
437
+        assertFalse(Arraz.totalOfTensIs30(input));
438
+    }
439
+
440
+    @Test
441
+    public void test2tensTotal30() {
442
+        int[] input = {8, 10, 3, 65, 10, 1, 10};
443
+
444
+        assertTrue(Arraz.totalOfTensIs30(input));
445
+    }
446
+
447
+    @Test
448
+    public void test1find2ndSmallest() {
449
+        int[] input = {3, 4, 9, 2, 1};
450
+        int expected = 2;
451
+        int actual = Arraz.find2ndSmallestValueFromArray(input);
452
+
453
+        assertEquals(expected, actual);
454
+    }
455
+
456
+    @Test
457
+    public void test2find2ndSmallest() {
458
+        int[] input = {8, 2, 3, 5, 7, 1, 9};
459
+        int expected = 2;
460
+        int actual = Arraz.find2ndSmallestValueFromArray(input);
461
+
462
+        assertEquals(expected, actual);
463
+    }
464
+
465
+    @Test
466
+    public void test1reverseCopy() {
467
+        int[] input = {3, 4, 9, 2, 1};
468
+        int[] expected = {1, 2, 9, 4, 3};
469
+        int[] actual = Arraz.reverseCopyOfArray(input);
470
+
471
+        assertTrue(Arrays.equals(expected, actual));
472
+    }
473
+
474
+    @Test
475
+    public void test2reverseCopy() {
476
+        int[] input = {1, 2, 8};
477
+        int[] expected = {8, 2, 1};
478
+        int[] actual = Arraz.reverseCopyOfArray(input);
479
+
480
+        assertTrue(Arrays.equals(expected, actual));
481
+    }
482
+
483
+    @Test
484
+    public void test1removeLastItem() {
485
+        int[] input = {3, 4, 9, 2, 1};
486
+        int[] expected = {3, 4, 9, 2};
487
+        int[] actual = Arraz.removeLastItem(input);
488
+
489
+        assertTrue(Arrays.equals(expected, actual));
490
+    }
491
+
492
+    @Test
493
+    public void test2removeLastItem() {
494
+        int[] input = {1, 2, 8};
495
+        int[] expected = {1, 2};
496
+        int[] actual = Arraz.removeLastItem(input);
497
+
498
+        assertTrue(Arrays.equals(expected, actual));
499
+    }
500
+
501
+    @Test
502
+    public void test1removeFirstItem() {
503
+        int[] input = {3, 4, 9, 2, 1};
504
+        int[] expected = {4, 9, 2, 1};
505
+        int[] actual = Arraz.removeFirstItem(input);
506
+
507
+        assertTrue(Arrays.equals(expected, actual));
508
+    }
509
+
510
+    @Test
511
+    public void test2removeFirstItem() {
512
+        int[] input = {1, 2, 8};
513
+        int[] expected = {2, 8};
514
+        int[] actual = Arraz.removeFirstItem(input);
515
+
516
+        assertTrue(Arrays.equals(expected, actual));
517
+    }
518
+
519
+    @Test
520
+    public void test1insertAtStart() {
521
+        int[] input = {3, 4, 9, 2, 1};
522
+        int numb = 7;
523
+        int[] expected = {7, 3, 4, 9, 2, 1};
524
+        int[] actual = Arraz.insertAtStart(input, numb);
525
+
526
+        assertTrue(Arrays.equals(expected, actual));
527
+    }
528
+
529
+    @Test
530
+    public void test2insertIAtStart() {
531
+        int[] input = {8, 2};
532
+        int numb = 7;
533
+        int[] expected = {7, 8, 2};
534
+        int[] actual = Arraz.insertAtStart(input, numb);
535
+
536
+        assertTrue(Arrays.equals(expected, actual));
537
+    }
538
+
539
+    @Test
540
+    public void test1insertAtEnd() {
541
+        int[] input = {3, 4, 9, 2, 1};
542
+        int numb = 7;
543
+        int[] expected = {3, 4, 9, 2, 1, 7};
544
+        int[] actual = Arraz.insertAtEnd(input, numb);
545
+
546
+        assertTrue(Arrays.equals(expected, actual));
547
+    }
548
+
549
+    @Test
550
+    public void test2insertIAtEnd() {
551
+        int[] input = {8, 2};
552
+        int numb = 7;
553
+        int[] expected = {8, 2, 7};
554
+        int[] actual = Arraz.insertAtEnd(input, numb);
555
+
556
+        assertTrue(Arrays.equals(expected, actual));
557
+    }
558
+
559
+    @Test
560
+    public void test1sortEvenOdd() {
561
+        int[] input = {3, 4, 9, 2, 1};
562
+        int[] expected = {4, 2, 1, 9, 3};
563
+        int[] actual = Arraz.sortArrayIntoEvensThenOdds(input);
564
+
565
+        assertTrue(Arrays.equals(expected, actual));
566
+    }
567
+
568
+    @Test
569
+    public void test2sortEvenOdd() {
570
+        int[] input = {1, 3, 8, 9, 2};
571
+        int[] expected = {8, 2, 9, 3, 1};
572
+        int[] actual = Arraz.sortArrayIntoEvensThenOdds(input);
573
+
574
+        assertTrue(Arrays.equals(expected, actual));
575
+    }
576
+
577
+
578
+
419 579
 }