Browse Source

finished methods and corresponding tests

Trinh Tong 6 years ago
parent
commit
960e06da47

+ 1
- 1
.idea/compiler.xml View File

10
       </profile>
10
       </profile>
11
     </annotationProcessing>
11
     </annotationProcessing>
12
     <bytecodeTargetLevel>
12
     <bytecodeTargetLevel>
13
-      <module name="arraz" target="1.5" />
13
+      <module name="arraz" target="6" />
14
     </bytecodeTargetLevel>
14
     </bytecodeTargetLevel>
15
   </component>
15
   </component>
16
 </project>
16
 </project>

+ 196
- 86
.idea/workspace.xml View File

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" afterDir="false" />
7
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java" afterDir="false" />
8
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" afterDir="false" />
5
+      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/TwoSmallest.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
9
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
7
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/arraz/arraz.iml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/arraz.iml" afterDir="false" />
9
+      <change beforePath="$PROJECT_DIR$/arraz/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/pom.xml" afterDir="false" />
10
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
10
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
11
+      <change beforePath="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" afterDir="false" />
12
+      <change beforePath="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" afterDir="false" />
11
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
13
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
12
     </list>
14
     </list>
13
     <ignored path="$PROJECT_DIR$/arraz/target/" />
15
     <ignored path="$PROJECT_DIR$/arraz/target/" />
27
       </usages-collector>
29
       </usages-collector>
28
       <usages-collector id="statistics.file.types.edit">
30
       <usages-collector id="statistics.file.types.edit">
29
         <counts>
31
         <counts>
30
-          <entry key="JAVA" value="5319" />
32
+          <entry key="JAVA" value="10337" />
31
         </counts>
33
         </counts>
32
       </usages-collector>
34
       </usages-collector>
33
       <usages-collector id="statistics.file.types.open">
35
       <usages-collector id="statistics.file.types.open">
34
         <counts>
36
         <counts>
35
           <entry key="CLASS" value="1" />
37
           <entry key="CLASS" value="1" />
36
-          <entry key="JAVA" value="7" />
38
+          <entry key="JAVA" value="12" />
37
           <entry key="Markdown" value="1" />
39
           <entry key="Markdown" value="1" />
38
         </counts>
40
         </counts>
39
       </usages-collector>
41
       </usages-collector>
43
     <splitter split-orientation="horizontal" split-proportion="0.6340755">
45
     <splitter split-orientation="horizontal" split-proportion="0.6340755">
44
       <split-first>
46
       <split-first>
45
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
47
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
46
-          <file pinned="false" current-in-tab="true">
48
+          <file pinned="false" current-in-tab="false">
47
             <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
49
             <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
48
               <provider selected="true" editor-type-id="text-editor">
50
               <provider selected="true" editor-type-id="text-editor">
49
-                <state relative-caret-position="257">
50
-                  <caret line="151" column="41" lean-forward="true" selection-start-line="151" selection-start-column="41" selection-end-line="151" selection-end-column="41" />
51
+                <state relative-caret-position="423">
52
+                  <caret line="295" column="47" selection-start-line="295" selection-start-column="47" selection-end-line="295" selection-end-column="47" />
51
                   <folding>
53
                   <folding>
52
-                    <element signature="imports" expanded="true" />
53
                     <element signature="e#2787#2788#0" expanded="true" />
54
                     <element signature="e#2787#2788#0" expanded="true" />
54
                     <element signature="e#2834#2835#0" expanded="true" />
55
                     <element signature="e#2834#2835#0" expanded="true" />
56
+                    <element signature="e#4308#4317#0" expanded="true" />
57
+                    <element signature="e#4443#4452#0" expanded="true" />
58
+                    <element signature="e#6683#6684#0" expanded="true" />
59
+                    <element signature="e#6727#6728#0" expanded="true" />
60
+                    <element signature="e#8217#8226#0" expanded="true" />
61
+                    <element signature="e#8269#8278#0" expanded="true" />
55
                   </folding>
62
                   </folding>
56
                 </state>
63
                 </state>
57
               </provider>
64
               </provider>
58
             </entry>
65
             </entry>
59
           </file>
66
           </file>
60
           <file pinned="false" current-in-tab="false">
67
           <file pinned="false" current-in-tab="false">
61
-            <entry file="file://$PROJECT_DIR$/arraz/src/main/java/MaxMin.java">
68
+            <entry file="file://$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java">
62
               <provider selected="true" editor-type-id="text-editor">
69
               <provider selected="true" editor-type-id="text-editor">
63
-                <state relative-caret-position="40">
64
-                  <caret line="10" selection-start-line="10" selection-end-line="10" />
70
+                <state relative-caret-position="46">
71
+                  <caret line="2" column="26" selection-start-line="2" selection-start-column="26" selection-end-line="2" selection-end-column="26" />
72
+                  <folding>
73
+                    <element signature="e#67#68#0" expanded="true" />
74
+                    <element signature="e#102#103#0" expanded="true" />
75
+                  </folding>
65
                 </state>
76
                 </state>
66
               </provider>
77
               </provider>
67
             </entry>
78
             </entry>
68
           </file>
79
           </file>
69
           <file pinned="false" current-in-tab="false">
80
           <file pinned="false" current-in-tab="false">
81
+            <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
82
+              <provider selected="true" editor-type-id="text-editor">
83
+                <state relative-caret-position="92">
84
+                  <caret line="4" lean-forward="true" selection-start-line="4" selection-end-line="7" />
85
+                  <folding>
86
+                    <element signature="e#326#327#0" expanded="true" />
87
+                    <element signature="e#357#358#0" expanded="true" />
88
+                    <element signature="e#408#409#0" expanded="true" />
89
+                    <element signature="e#448#449#0" expanded="true" />
90
+                    <element signature="e#485#486#0" expanded="true" />
91
+                    <element signature="e#515#516#0" expanded="true" />
92
+                    <element signature="e#564#565#0" expanded="true" />
93
+                    <element signature="e#602#603#0" expanded="true" />
94
+                  </folding>
95
+                </state>
96
+              </provider>
97
+            </entry>
98
+          </file>
99
+          <file pinned="false" current-in-tab="true">
70
             <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
100
             <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
71
               <provider selected="true" editor-type-id="text-editor">
101
               <provider selected="true" editor-type-id="text-editor">
72
-                <state relative-caret-position="316">
73
-                  <caret line="196" column="4" selection-start-line="196" selection-start-column="4" selection-end-line="196" selection-end-column="4" />
102
+                <state relative-caret-position="224">
103
+                  <caret line="374" column="9" lean-forward="true" selection-start-line="374" selection-start-column="9" selection-end-line="374" selection-end-column="9" />
74
                   <folding>
104
                   <folding>
75
                     <element signature="imports" expanded="true" />
105
                     <element signature="imports" expanded="true" />
76
                     <element signature="e#3089#3090#0" expanded="true" />
106
                     <element signature="e#3089#3090#0" expanded="true" />
77
                     <element signature="e#3119#3120#0" expanded="true" />
107
                     <element signature="e#3119#3120#0" expanded="true" />
78
                     <element signature="e#4817#4818#0" expanded="true" />
108
                     <element signature="e#4817#4818#0" expanded="true" />
79
                     <element signature="e#4906#4907#0" expanded="true" />
109
                     <element signature="e#4906#4907#0" expanded="true" />
110
+                    <element signature="e#5657#5658#0" expanded="true" />
111
+                    <element signature="e#5687#5688#0" expanded="true" />
112
+                    <element signature="e#6216#6225#0" expanded="true" />
113
+                    <element signature="e#6452#6461#0" expanded="true" />
114
+                    <element signature="e#7048#7049#0" expanded="true" />
115
+                    <element signature="e#7075#7076#0" expanded="true" />
116
+                    <element signature="e#7174#7175#0" expanded="true" />
117
+                    <element signature="e#7241#7242#0" expanded="true" />
118
+                    <element signature="e#7630#7631#0" expanded="true" />
119
+                    <element signature="e#7687#7688#0" expanded="true" />
120
+                    <element signature="e#7882#7883#0" expanded="true" />
121
+                    <element signature="e#7910#7911#0" expanded="true" />
80
                   </folding>
122
                   </folding>
81
                 </state>
123
                 </state>
82
               </provider>
124
               </provider>
110
       </list>
152
       </list>
111
     </option>
153
     </option>
112
   </component>
154
   </component>
155
+  <component name="FindInProjectRecents">
156
+    <findStrings>
157
+      <find>isOdd</find>
158
+    </findStrings>
159
+  </component>
113
   <component name="Git.Settings">
160
   <component name="Git.Settings">
114
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
161
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
115
   </component>
162
   </component>
127
         <option value="$PROJECT_DIR$/arraz/src/main/java/ArrazUtilities.java" />
174
         <option value="$PROJECT_DIR$/arraz/src/main/java/ArrazUtilities.java" />
128
         <option value="$PROJECT_DIR$/arraz/src/main/java/NumIUtiils.java" />
175
         <option value="$PROJECT_DIR$/arraz/src/main/java/NumIUtiils.java" />
129
         <option value="$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java" />
176
         <option value="$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java" />
130
-        <option value="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" />
131
         <option value="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" />
177
         <option value="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" />
132
-        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
178
+        <option value="$PROJECT_DIR$/arraz/src/main/java/TwoSmallest.java" />
179
+        <option value="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" />
133
         <option value="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" />
180
         <option value="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" />
181
+        <option value="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" />
134
       </list>
182
       </list>
135
     </option>
183
     </option>
136
   </component>
184
   </component>
152
     <option name="width" value="1440" />
200
     <option name="width" value="1440" />
153
     <option name="height" value="877" />
201
     <option name="height" value="877" />
154
   </component>
202
   </component>
203
+  <component name="ProjectInspectionProfilesVisibleTreeState">
204
+    <entry key="Project Default">
205
+      <profile-state>
206
+        <expanded-state>
207
+          <State />
208
+          <State>
209
+            <id>Java</id>
210
+          </State>
211
+          <State>
212
+            <id>Probable bugsJava</id>
213
+          </State>
214
+        </expanded-state>
215
+        <selected-state>
216
+          <State>
217
+            <id>ConstantConditions</id>
218
+          </State>
219
+        </selected-state>
220
+      </profile-state>
221
+    </entry>
222
+  </component>
155
   <component name="ProjectView">
223
   <component name="ProjectView">
156
     <navigator proportions="" version="1">
224
     <navigator proportions="" version="1">
157
       <foldersAlwaysOnTop value="true" />
225
       <foldersAlwaysOnTop value="true" />
207
     <property name="GO_FMT" value="false" />
275
     <property name="GO_FMT" value="false" />
208
     <property name="WebServerToolWindowFactoryState" value="false" />
276
     <property name="WebServerToolWindowFactoryState" value="false" />
209
     <property name="aspect.path.notification.shown" value="true" />
277
     <property name="aspect.path.notification.shown" value="true" />
210
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544154666796" />
278
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544196182964" />
211
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
279
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
212
     <property name="extract.method.default.visibility" value="private" />
280
     <property name="extract.method.default.visibility" value="private" />
213
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
281
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
235
       </list>
303
       </list>
236
     </option>
304
     </option>
237
   </component>
305
   </component>
238
-  <component name="RunManager" selected="JUnit.ArrazTest.test2findMaxMindOfArray">
306
+  <component name="RunManager" selected="JUnit.ArrazTest">
239
     <configuration default="true" type="Applet" factoryName="Applet">
307
     <configuration default="true" type="Applet" factoryName="Applet">
240
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
308
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
241
       <method v="2">
309
       <method v="2">
248
         <option name="Make" enabled="true" />
316
         <option name="Make" enabled="true" />
249
       </method>
317
       </method>
250
     </configuration>
318
     </configuration>
251
-    <configuration name="ArrazTest.test1InsertIntoArrayAt" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
319
+    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
252
       <module name="arraz" />
320
       <module name="arraz" />
253
       <option name="PACKAGE_NAME" value="" />
321
       <option name="PACKAGE_NAME" value="" />
254
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
322
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
255
-      <option name="METHOD_NAME" value="test1InsertIntoArrayAt" />
256
-      <option name="TEST_OBJECT" value="method" />
257
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
323
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
258
       <method v="2">
324
       <method v="2">
259
         <option name="Make" enabled="true" />
325
         <option name="Make" enabled="true" />
260
       </method>
326
       </method>
261
     </configuration>
327
     </configuration>
262
-    <configuration name="ArrazTest.test1findMaxMinOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
328
+    <configuration name="ArrazTest.test1InsertAtEndAndCopy" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
263
       <module name="arraz" />
329
       <module name="arraz" />
264
       <option name="PACKAGE_NAME" value="" />
330
       <option name="PACKAGE_NAME" value="" />
265
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
331
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
266
-      <option name="METHOD_NAME" value="test1findMaxMinOfArray" />
332
+      <option name="METHOD_NAME" value="test1InsertAtEndAndCopy" />
267
       <option name="TEST_OBJECT" value="method" />
333
       <option name="TEST_OBJECT" value="method" />
268
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
334
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
269
       <method v="2">
335
       <method v="2">
270
         <option name="Make" enabled="true" />
336
         <option name="Make" enabled="true" />
271
       </method>
337
       </method>
272
     </configuration>
338
     </configuration>
273
-    <configuration name="ArrazTest.test1removeElementFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
339
+    <configuration name="ArrazTest.test1sortArrayIntoEvensThenOdds" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
274
       <module name="arraz" />
340
       <module name="arraz" />
275
       <option name="PACKAGE_NAME" value="" />
341
       <option name="PACKAGE_NAME" value="" />
276
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
342
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
277
-      <option name="METHOD_NAME" value="test1removeElementFromArray" />
343
+      <option name="METHOD_NAME" value="test1sortArrayIntoEvensThenOdds" />
278
       <option name="TEST_OBJECT" value="method" />
344
       <option name="TEST_OBJECT" value="method" />
279
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
345
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
280
       <method v="2">
346
       <method v="2">
281
         <option name="Make" enabled="true" />
347
         <option name="Make" enabled="true" />
282
       </method>
348
       </method>
283
     </configuration>
349
     </configuration>
284
-    <configuration name="ArrazTest.test2InsertIntoArrayAt" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
350
+    <configuration name="ArrazTest.test2InsertAtEndAndCopy" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
285
       <module name="arraz" />
351
       <module name="arraz" />
286
       <option name="PACKAGE_NAME" value="" />
352
       <option name="PACKAGE_NAME" value="" />
287
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
353
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
288
-      <option name="METHOD_NAME" value="test2InsertIntoArrayAt" />
354
+      <option name="METHOD_NAME" value="test2InsertAtEndAndCopy" />
289
       <option name="TEST_OBJECT" value="method" />
355
       <option name="TEST_OBJECT" value="method" />
290
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
356
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
291
       <method v="2">
357
       <method v="2">
292
         <option name="Make" enabled="true" />
358
         <option name="Make" enabled="true" />
293
       </method>
359
       </method>
294
     </configuration>
360
     </configuration>
295
-    <configuration name="ArrazTest.test2findMaxMindOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
361
+    <configuration name="ArrazTest.test2SortArrayIntoEvensThenodds" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
296
       <module name="arraz" />
362
       <module name="arraz" />
297
       <option name="PACKAGE_NAME" value="" />
363
       <option name="PACKAGE_NAME" value="" />
298
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
364
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
299
-      <option name="METHOD_NAME" value="test2findMaxMindOfArray" />
365
+      <option name="METHOD_NAME" value="test2SortArrayIntoEvensThenodds" />
300
       <option name="TEST_OBJECT" value="method" />
366
       <option name="TEST_OBJECT" value="method" />
301
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
367
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
302
       <method v="2">
368
       <method v="2">
327
       </method>
393
       </method>
328
     </configuration>
394
     </configuration>
329
     <list>
395
     <list>
330
-      <item itemvalue="JUnit.ArrazTest.test1removeElementFromArray" />
331
-      <item itemvalue="JUnit.ArrazTest.test1InsertIntoArrayAt" />
332
-      <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
333
-      <item itemvalue="JUnit.ArrazTest.test1findMaxMinOfArray" />
334
-      <item itemvalue="JUnit.ArrazTest.test2findMaxMindOfArray" />
396
+      <item itemvalue="JUnit.ArrazTest.test1InsertAtEndAndCopy" />
397
+      <item itemvalue="JUnit.ArrazTest.test2InsertAtEndAndCopy" />
398
+      <item itemvalue="JUnit.ArrazTest.test1sortArrayIntoEvensThenOdds" />
399
+      <item itemvalue="JUnit.ArrazTest.test2SortArrayIntoEvensThenodds" />
400
+      <item itemvalue="JUnit.ArrazTest" />
335
     </list>
401
     </list>
336
     <recent_temporary>
402
     <recent_temporary>
337
       <list>
403
       <list>
338
-        <item itemvalue="JUnit.ArrazTest.test2findMaxMindOfArray" />
339
-        <item itemvalue="JUnit.ArrazTest.test1findMaxMinOfArray" />
340
-        <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
341
-        <item itemvalue="JUnit.ArrazTest.test1InsertIntoArrayAt" />
342
-        <item itemvalue="JUnit.ArrazTest.test1removeElementFromArray" />
404
+        <item itemvalue="JUnit.ArrazTest" />
405
+        <item itemvalue="JUnit.ArrazTest.test2SortArrayIntoEvensThenodds" />
406
+        <item itemvalue="JUnit.ArrazTest.test1sortArrayIntoEvensThenOdds" />
407
+        <item itemvalue="JUnit.ArrazTest.test2InsertAtEndAndCopy" />
408
+        <item itemvalue="JUnit.ArrazTest.test1InsertAtEndAndCopy" />
343
       </list>
409
       </list>
344
     </recent_temporary>
410
     </recent_temporary>
345
   </component>
411
   </component>
356
       <workItem from="1543955862749" duration="2347000" />
422
       <workItem from="1543955862749" duration="2347000" />
357
       <workItem from="1543958998826" duration="113000" />
423
       <workItem from="1543958998826" duration="113000" />
358
       <workItem from="1544020724645" duration="762000" />
424
       <workItem from="1544020724645" duration="762000" />
359
-      <workItem from="1544143319002" duration="9951000" />
425
+      <workItem from="1544143319002" duration="17812000" />
360
     </task>
426
     </task>
361
     <task id="LOCAL-00001" summary="readme and docs">
427
     <task id="LOCAL-00001" summary="readme and docs">
362
       <created>1544021313039</created>
428
       <created>1544021313039</created>
369
     <servers />
435
     <servers />
370
   </component>
436
   </component>
371
   <component name="TestHistory">
437
   <component name="TestHistory">
372
-    <history-entry file="ArrazTest_test1removeElementFromArray - 2018.12.06 at 22h 32m 14s.xml">
373
-      <configuration name="ArrazTest.test1removeElementFromArray" configurationId="JUnit" />
438
+    <history-entry file="ArrazTest_test1InsertAtStartAndCopy - 2018.12.07 at 09h 59m 44s.xml">
439
+      <configuration name="ArrazTest.test1InsertAtStartAndCopy" configurationId="JUnit" />
374
     </history-entry>
440
     </history-entry>
375
-    <history-entry file="ArrazTest_test2RemoveElementFromArray - 2018.12.06 at 22h 32m 55s.xml">
376
-      <configuration name="ArrazTest.test2RemoveElementFromArray" configurationId="JUnit" />
441
+    <history-entry file="ArrazTest_test1InsertAtStartAndCopy - 2018.12.07 at 10h 00m 00s.xml">
442
+      <configuration name="ArrazTest.test1InsertAtStartAndCopy" configurationId="JUnit" />
377
     </history-entry>
443
     </history-entry>
378
-    <history-entry file="ArrazTest_test1removeElementFromArray - 2018.12.06 at 22h 34m 36s.xml">
379
-      <configuration name="ArrazTest.test1removeElementFromArray" configurationId="JUnit" />
444
+    <history-entry file="ArrazTest_test2InsertAtStartAndCopy - 2018.12.07 at 10h 01m 05s.xml">
445
+      <configuration name="ArrazTest.test2InsertAtStartAndCopy" configurationId="JUnit" />
380
     </history-entry>
446
     </history-entry>
381
-    <history-entry file="ArrazTest_test1InsertIntoArrayAt - 2018.12.06 at 22h 41m 58s.xml">
382
-      <configuration name="ArrazTest.test1InsertIntoArrayAt" configurationId="JUnit" />
447
+    <history-entry file="ArrazTest_test1InsertAtEndAndCopy - 2018.12.07 at 10h 02m 33s.xml">
448
+      <configuration name="ArrazTest.test1InsertAtEndAndCopy" configurationId="JUnit" />
383
     </history-entry>
449
     </history-entry>
384
-    <history-entry file="ArrazTest_test2InsertIntoArrayAt - 2018.12.06 at 22h 43m 33s.xml">
385
-      <configuration name="ArrazTest.test2InsertIntoArrayAt" configurationId="JUnit" />
450
+    <history-entry file="ArrazTest_test1InsertAtEndAndCopy - 2018.12.07 at 10h 04m 00s.xml">
451
+      <configuration name="ArrazTest.test1InsertAtEndAndCopy" configurationId="JUnit" />
386
     </history-entry>
452
     </history-entry>
387
-    <history-entry file="ArrazTest_test1findMaxMinOfArray - 2018.12.06 at 22h 49m 18s.xml">
388
-      <configuration name="ArrazTest.test1findMaxMinOfArray" configurationId="JUnit" />
453
+    <history-entry file="ArrazTest_test1InsertAtEndAndCopy - 2018.12.07 at 10h 04m 11s.xml">
454
+      <configuration name="ArrazTest.test1InsertAtEndAndCopy" configurationId="JUnit" />
389
     </history-entry>
455
     </history-entry>
390
-    <history-entry file="ArrazTest_test1findMaxMinOfArray - 2018.12.06 at 22h 49m 31s.xml">
391
-      <configuration name="ArrazTest.test1findMaxMinOfArray" configurationId="JUnit" />
456
+    <history-entry file="ArrazTest_test2InsertAtEndAndCopy - 2018.12.07 at 10h 05m 48s.xml">
457
+      <configuration name="ArrazTest.test2InsertAtEndAndCopy" configurationId="JUnit" />
392
     </history-entry>
458
     </history-entry>
393
-    <history-entry file="ArrazTest_test2findMaxMindOfArray - 2018.12.06 at 22h 50m 12s.xml">
394
-      <configuration name="ArrazTest.test2findMaxMindOfArray" configurationId="JUnit" />
459
+    <history-entry file="ArrazTest_test1sortArrayIntoEvensThenOdds - 2018.12.07 at 10h 18m 49s.xml">
460
+      <configuration name="ArrazTest.test1sortArrayIntoEvensThenOdds" configurationId="JUnit" />
395
     </history-entry>
461
     </history-entry>
396
-    <history-entry file="ArrazTest_test2findMaxMindOfArray - 2018.12.06 at 22h 50m 54s.xml">
397
-      <configuration name="ArrazTest.test2findMaxMindOfArray" configurationId="JUnit" />
462
+    <history-entry file="ArrazTest_test1sortArrayIntoEvensThenOdds - 2018.12.07 at 10h 20m 17s.xml">
463
+      <configuration name="ArrazTest.test1sortArrayIntoEvensThenOdds" configurationId="JUnit" />
398
     </history-entry>
464
     </history-entry>
399
-    <history-entry file="ArrazTest_test2findMaxMindOfArray - 2018.12.06 at 22h 51m 09s.xml">
400
-      <configuration name="ArrazTest.test2findMaxMindOfArray" configurationId="JUnit" />
465
+    <history-entry file="ArrazTest_test1sortArrayIntoEvensThenOdds - 2018.12.07 at 10h 22m 00s.xml">
466
+      <configuration name="ArrazTest.test1sortArrayIntoEvensThenOdds" configurationId="JUnit" />
401
     </history-entry>
467
     </history-entry>
402
   </component>
468
   </component>
403
   <component name="TimeTrackingManager">
469
   <component name="TimeTrackingManager">
404
-    <option name="totallyTimeSpent" value="13173000" />
470
+    <option name="totallyTimeSpent" value="21034000" />
405
   </component>
471
   </component>
406
   <component name="ToolWindowManager">
472
   <component name="ToolWindowManager">
407
     <frame x="0" y="23" width="1440" height="877" extended-state="6" />
473
     <frame x="0" y="23" width="1440" height="877" extended-state="6" />
423
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
489
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
424
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
490
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
425
       <window_info anchor="bottom" id="TODO" order="6" />
491
       <window_info anchor="bottom" id="TODO" order="6" />
426
-      <window_info anchor="bottom" id="Terminal" order="7" />
492
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.32899868" />
427
       <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
493
       <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
428
       <window_info anchor="bottom" id="Version Control" order="9" />
494
       <window_info anchor="bottom" id="Version Control" order="9" />
429
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
495
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
509
         </state>
575
         </state>
510
       </provider>
576
       </provider>
511
     </entry>
577
     </entry>
512
-    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java">
578
+    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/TwoSmallest.java">
513
       <provider selected="true" editor-type-id="text-editor">
579
       <provider selected="true" editor-type-id="text-editor">
514
-        <state>
515
-          <caret column="16" lean-forward="true" selection-start-column="16" selection-end-column="16" />
580
+        <state relative-caret-position="-75">
581
+          <caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
516
           <folding>
582
           <folding>
517
-            <element signature="e#70#71#0" expanded="true" />
518
-            <element signature="e#94#95#0" expanded="true" />
583
+            <element signature="e#155#156#0" expanded="true" />
584
+            <element signature="e#186#187#0" expanded="true" />
585
+            <element signature="e#231#232#0" expanded="true" />
586
+            <element signature="e#271#272#0" expanded="true" />
587
+            <element signature="e#310#311#0" expanded="true" />
588
+            <element signature="e#348#349#0" expanded="true" />
589
+            <element signature="e#407#408#0" expanded="true" />
590
+            <element signature="e#461#462#0" expanded="true" />
519
           </folding>
591
           </folding>
520
         </state>
592
         </state>
521
       </provider>
593
       </provider>
522
     </entry>
594
     </entry>
595
+    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/MaxMin.java">
596
+      <provider selected="true" editor-type-id="text-editor">
597
+        <state relative-caret-position="40">
598
+          <caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
599
+        </state>
600
+      </provider>
601
+    </entry>
523
     <entry file="file://$PROJECT_DIR$/README.md">
602
     <entry file="file://$PROJECT_DIR$/README.md">
524
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
603
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
525
         <state split_layout="SECOND">
604
         <state split_layout="SECOND">
532
     </entry>
611
     </entry>
533
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
612
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
534
       <provider selected="true" editor-type-id="text-editor">
613
       <provider selected="true" editor-type-id="text-editor">
535
-        <state relative-caret-position="368">
536
-          <caret line="21" column="21" lean-forward="true" selection-start-line="21" selection-start-column="21" selection-end-line="21" selection-end-column="21" />
614
+        <state relative-caret-position="92">
615
+          <caret line="4" lean-forward="true" selection-start-line="4" selection-end-line="7" />
616
+          <folding>
617
+            <element signature="e#326#327#0" expanded="true" />
618
+            <element signature="e#357#358#0" expanded="true" />
619
+            <element signature="e#408#409#0" expanded="true" />
620
+            <element signature="e#448#449#0" expanded="true" />
621
+            <element signature="e#485#486#0" expanded="true" />
622
+            <element signature="e#515#516#0" expanded="true" />
623
+            <element signature="e#564#565#0" expanded="true" />
624
+            <element signature="e#602#603#0" expanded="true" />
625
+          </folding>
537
         </state>
626
         </state>
538
       </provider>
627
       </provider>
539
     </entry>
628
     </entry>
540
-    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
629
+    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/NumberUtils.java">
541
       <provider selected="true" editor-type-id="text-editor">
630
       <provider selected="true" editor-type-id="text-editor">
542
-        <state relative-caret-position="316">
543
-          <caret line="196" column="4" selection-start-line="196" selection-start-column="4" selection-end-line="196" selection-end-column="4" />
631
+        <state relative-caret-position="46">
632
+          <caret line="2" column="26" selection-start-line="2" selection-start-column="26" selection-end-line="2" selection-end-column="26" />
544
           <folding>
633
           <folding>
545
-            <element signature="imports" expanded="true" />
546
-            <element signature="e#3089#3090#0" expanded="true" />
547
-            <element signature="e#3119#3120#0" expanded="true" />
548
-            <element signature="e#4817#4818#0" expanded="true" />
549
-            <element signature="e#4906#4907#0" expanded="true" />
634
+            <element signature="e#67#68#0" expanded="true" />
635
+            <element signature="e#102#103#0" expanded="true" />
550
           </folding>
636
           </folding>
551
         </state>
637
         </state>
552
       </provider>
638
       </provider>
553
     </entry>
639
     </entry>
554
-    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/MaxMin.java">
640
+    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
555
       <provider selected="true" editor-type-id="text-editor">
641
       <provider selected="true" editor-type-id="text-editor">
556
-        <state relative-caret-position="40">
557
-          <caret line="10" selection-start-line="10" selection-end-line="10" />
642
+        <state relative-caret-position="423">
643
+          <caret line="295" column="47" selection-start-line="295" selection-start-column="47" selection-end-line="295" selection-end-column="47" />
644
+          <folding>
645
+            <element signature="e#2787#2788#0" expanded="true" />
646
+            <element signature="e#2834#2835#0" expanded="true" />
647
+            <element signature="e#4308#4317#0" expanded="true" />
648
+            <element signature="e#4443#4452#0" expanded="true" />
649
+            <element signature="e#6683#6684#0" expanded="true" />
650
+            <element signature="e#6727#6728#0" expanded="true" />
651
+            <element signature="e#8217#8226#0" expanded="true" />
652
+            <element signature="e#8269#8278#0" expanded="true" />
653
+          </folding>
558
         </state>
654
         </state>
559
       </provider>
655
       </provider>
560
     </entry>
656
     </entry>
561
-    <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
657
+    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
562
       <provider selected="true" editor-type-id="text-editor">
658
       <provider selected="true" editor-type-id="text-editor">
563
-        <state relative-caret-position="257">
564
-          <caret line="151" column="41" lean-forward="true" selection-start-line="151" selection-start-column="41" selection-end-line="151" selection-end-column="41" />
659
+        <state relative-caret-position="224">
660
+          <caret line="374" column="9" lean-forward="true" selection-start-line="374" selection-start-column="9" selection-end-line="374" selection-end-column="9" />
565
           <folding>
661
           <folding>
566
             <element signature="imports" expanded="true" />
662
             <element signature="imports" expanded="true" />
567
-            <element signature="e#2787#2788#0" expanded="true" />
568
-            <element signature="e#2834#2835#0" expanded="true" />
663
+            <element signature="e#3089#3090#0" expanded="true" />
664
+            <element signature="e#3119#3120#0" expanded="true" />
665
+            <element signature="e#4817#4818#0" expanded="true" />
666
+            <element signature="e#4906#4907#0" expanded="true" />
667
+            <element signature="e#5657#5658#0" expanded="true" />
668
+            <element signature="e#5687#5688#0" expanded="true" />
669
+            <element signature="e#6216#6225#0" expanded="true" />
670
+            <element signature="e#6452#6461#0" expanded="true" />
671
+            <element signature="e#7048#7049#0" expanded="true" />
672
+            <element signature="e#7075#7076#0" expanded="true" />
673
+            <element signature="e#7174#7175#0" expanded="true" />
674
+            <element signature="e#7241#7242#0" expanded="true" />
675
+            <element signature="e#7630#7631#0" expanded="true" />
676
+            <element signature="e#7687#7688#0" expanded="true" />
677
+            <element signature="e#7882#7883#0" expanded="true" />
678
+            <element signature="e#7910#7911#0" expanded="true" />
569
           </folding>
679
           </folding>
570
         </state>
680
         </state>
571
       </provider>
681
       </provider>

+ 1
- 1
arraz/arraz.iml View File

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
4
     <output url="file://$MODULE_DIR$/target/classes" />
4
     <output url="file://$MODULE_DIR$/target/classes" />
5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
     <content url="file://$MODULE_DIR$">
6
     <content url="file://$MODULE_DIR$">

+ 12
- 0
arraz/pom.xml View File

7
     <groupId>rocks.zipcode.arraysgonewild</groupId>
7
     <groupId>rocks.zipcode.arraysgonewild</groupId>
8
     <artifactId>arraz</artifactId>
8
     <artifactId>arraz</artifactId>
9
     <version>1.0-SNAPSHOT</version>
9
     <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>6</source>
17
+                    <target>6</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
10
     <dependencies>
22
     <dependencies>
11
         <dependency>
23
         <dependency>
12
             <groupId>junit</groupId>
24
             <groupId>junit</groupId>

+ 136
- 2
arraz/src/main/java/Arraz.java View File

1
-import java.util.Arrays;
2
-import java.util.Iterator;
1
+import java.util.*;
3
 
2
 
4
 public class Arraz {
3
 public class Arraz {
5
 
4
 
160
 
159
 
161
         return maxMin;
160
         return maxMin;
162
     }
161
     }
162
+
163
+    public static Integer[] removeDupesFromArray(Integer[] arr) {
164
+        Set<Integer> setNoDupes = new LinkedHashSet<Integer>(Arrays.asList(arr));
165
+        return setNoDupes.toArray(new Integer[setNoDupes.size()]);
166
+    }
167
+
168
+    public static Integer find2ndLargestValueFromArray(Integer[] arr) {
169
+        Set<Integer> setNoDupes = new TreeSet<Integer>(Arrays.asList(arr));
170
+        Integer[] orderedArr = setNoDupes.toArray(new Integer[setNoDupes.size()]);
171
+
172
+        if (orderedArr.length > 1) {
173
+            return orderedArr[1];
174
+        } else if (orderedArr.length == 1) {
175
+            return orderedArr[0];
176
+        } else {
177
+            return null;
178
+        }
179
+    }
180
+
181
+    public static ArrayList<Integer> makeMeAnArrayListFromArray(Integer[] arr) {
182
+        return new ArrayList<Integer>(Arrays.asList(arr));
183
+    }
184
+
185
+    public static Integer[] makeMeAnArrayFromArrayList(ArrayList<Integer> arrayList) {
186
+        return arrayList.toArray(new Integer[arrayList.size()]);
187
+    }
188
+
189
+    public static boolean check2ArraysForEqual(Integer[] ints, Integer[] ints1) {
190
+        if (ints.length != ints1.length)  {
191
+            return false;
192
+        }
193
+        for (int i = 0; i < ints.length; i++) {
194
+            if (ints[i] != ints1[i]) {
195
+                return false;
196
+            }
197
+        }
198
+        return true;
199
+    }
200
+
201
+    public static int averageArrayWithoutMaxMin(Integer[] arr) {
202
+        MaxMin mm = findMaxMinOfArray(arr);
203
+        Integer[] noMax = removeElementFromArray(arr, mm.getMax());
204
+        Integer[] noMaxOrMin = removeElementFromArray(noMax, mm.getMin());
205
+
206
+        return averageOfArray(noMaxOrMin);
207
+    }
208
+
209
+    public static boolean arrayHas65and77(Integer[] arr) {
210
+        return makeMeAnArrayListFromArray(arr).contains(65) && makeMeAnArrayListFromArray(arr).contains(77);
211
+    }
212
+
213
+    public static boolean theTotalOfTensIs30(Integer[] arr) {
214
+        int sum = 0;
215
+        for (Integer i: arr
216
+             ) {
217
+            if (i % 10 == 0) {
218
+                sum += i;
219
+            }
220
+        }
221
+
222
+        return sum == 30;
223
+    }
224
+
225
+    public static TwoSmallest find2Smallest(Integer[] ints) {
226
+        if (ints.length > 1) {
227
+            TwoSmallest twoSmallest = new TwoSmallest();
228
+            int smallest = findMaxMinOfArray(ints).getMin();
229
+            twoSmallest.setSmallest(smallest);
230
+
231
+            Integer[] secondSmallest = removeElementFromArray(ints, smallest);
232
+            twoSmallest.setSecond_smallest(findMaxMinOfArray(secondSmallest).getMin());
233
+
234
+            return twoSmallest;
235
+        }
236
+        return null;
237
+    }
238
+
239
+    public static Integer[] makeMeACopyPlease(Integer[] arr) {
240
+        return copyArrayByInterator(reverseArray(arr));
241
+    }
242
+
243
+    private static Integer[] removeElementAtIndex(Integer[] arr, int index) {
244
+        if (index > arr.length) { return arr; }
245
+
246
+        Integer[] arr2 = new Integer[arr.length - 1];
247
+
248
+        int arr2Index = 0;
249
+        for (int i = 0; i < arr.length; i++) {
250
+            if (i != index) {
251
+                arr2[arr2Index++] = arr[i];
252
+            }
253
+        }
254
+
255
+        return arr2;
256
+    }
257
+
258
+    public static Integer[] removeLastItemAndCopy(Integer[] arr) {
259
+        Integer[] arr2 = removeElementAtIndex(arr, arr.length -1);
260
+        return copyArrayByInterator(arr2);
261
+    }
262
+
263
+    public static Integer[] removeFirstItemAndCopy(Integer[] arr) {
264
+        return copyArrayByInterator(removeElementAtIndex(arr, 0));
265
+    }
266
+
267
+    public static Integer[] insert(Integer[] arr, int index, int value) {
268
+        Integer[] newArray = new Integer[arr.length + 1];
269
+        System.arraycopy(arr, 0, newArray, 0, index);
270
+        System.arraycopy(arr, index, newArray,index + 1, newArray.length - (index + 1));
271
+        newArray[index] = value;
272
+        return newArray;
273
+    }
274
+    public static Integer[] insertAtStartAndCopy(Integer[] arr, int value) {
275
+        return copyArrayByInterator(insert(arr, 0, value));
276
+    }
277
+
278
+    public static Integer[] insertAtEndAndCopy(Integer[] arr, int value) {
279
+        return copyArrayByInterator((insert(arr, arr.length, value)));
280
+    }
281
+
282
+
283
+    public static Integer[] sortArrayIntoEvensThenOdds(Integer[] arr) {
284
+        ArrayList<Integer> odds = new ArrayList<Integer>();
285
+        ArrayList<Integer> evens = new ArrayList<Integer>();
286
+
287
+        for (Integer i : arr) {
288
+            if (NumberUtils.isOdd(i)) {
289
+                odds.add(i);
290
+            } else {
291
+                evens.add(i);
292
+            }
293
+        }
294
+        evens.addAll(odds);
295
+        return makeMeAnArrayFromArrayList(evens);
296
+    }
163
 }
297
 }
164
 
298
 

+ 2
- 2
arraz/src/main/java/MaxMin.java View File

1
 public class MaxMin{
1
 public class MaxMin{
2
-    public int max = Integer.MAX_VALUE;
3
-    public int min = Integer.MIN_VALUE;
2
+    private int max = Integer.MAX_VALUE;
3
+    private int min = Integer.MIN_VALUE;
4
 
4
 
5
     public MaxMin(int max, int min) {
5
     public MaxMin(int max, int min) {
6
         this.max = max;
6
         this.max = max;

+ 23
- 2
arraz/src/main/java/OddEven.java View File

1
 public class OddEven{
1
 public class OddEven{
2
-    public int odds = 0;
3
-    public int evens = 0;
2
+    private int odds = 0;
3
+    private int evens = 0;
4
+
5
+    private Integer[] evensArr;
6
+    private Integer[] oddsArr;
7
+
4
 
8
 
5
     public OddEven(int odds, int evens) {
9
     public OddEven(int odds, int evens) {
6
         this.odds = odds;
10
         this.odds = odds;
7
         this.evens = evens;
11
         this.evens = evens;
8
     }
12
     }
9
 
13
 
14
+
10
     public OddEven() {
15
     public OddEven() {
11
     }
16
     }
12
 
17
 
18
+    public Integer[] getEvensArr() {
19
+        return evensArr;
20
+    }
21
+
22
+    public void setEvensArr(Integer[] evensArr) {
23
+        this.evensArr = evensArr;
24
+    }
25
+
26
+    public Integer[] getOddsArr() {
27
+        return oddsArr;
28
+    }
29
+
30
+    public void setOddsArr(Integer[] oddsArr) {
31
+        this.oddsArr = oddsArr;
32
+    }
33
+
13
     public int getOdds() {
34
     public int getOdds() {
14
         return odds;
35
         return odds;
15
     }
36
     }

+ 28
- 0
arraz/src/main/java/TwoSmallest.java View File

1
+public class TwoSmallest {
2
+    private int smallest = Integer.MIN_VALUE;
3
+    private int second_smallest= Integer.MIN_VALUE;
4
+
5
+    public TwoSmallest() {
6
+    }
7
+
8
+    public TwoSmallest(int smallest, int second_smallest) {
9
+        this.smallest = smallest;
10
+        this.second_smallest = second_smallest;
11
+    }
12
+
13
+    public int getSmallest() {
14
+        return smallest;
15
+    }
16
+
17
+    public void setSmallest(int smallest) {
18
+        this.smallest = smallest;
19
+    }
20
+
21
+    public int getSecond_smallest() {
22
+        return second_smallest;
23
+    }
24
+
25
+    public void setSecond_smallest(int second_smallest) {
26
+        this.second_smallest = second_smallest;
27
+    }
28
+}

+ 182
- 0
arraz/src/test/java/ArrazTest.java View File

1
+import org.junit.Assert;
1
 import org.junit.Test;
2
 import org.junit.Test;
2
 
3
 
4
+import java.util.ArrayList;
3
 import java.util.Arrays;
5
 import java.util.Arrays;
4
 
6
 
5
 import static java.lang.Double.NaN;
7
 import static java.lang.Double.NaN;
192
 
194
 
193
         assertEquals(0, Arraz.findMaxMinOfArray(arr).getMax());
195
         assertEquals(0, Arraz.findMaxMinOfArray(arr).getMax());
194
         assertEquals(0, Arraz.findMaxMinOfArray(arr).getMin());
196
         assertEquals(0, Arraz.findMaxMinOfArray(arr).getMin());
197
+    }
198
+
199
+    @Test
200
+    public void test1RemoveDupesFromArray() {
201
+        Integer[] arr = {0, 0, 0, 0, 3, 3, 1, 1, 5};
202
+        Integer[] exp = {0, 3, 1, 5};
203
+
204
+        assertEquals(exp, Arraz.removeDupesFromArray(arr));
205
+    }
206
+
207
+    @Test
208
+    public void test2RemoveDupesFromArray() {
209
+        assertEquals(ints2, Arraz.removeDupesFromArray(ints2));
210
+    }
211
+
212
+    @Test
213
+    public void test1find2ndLargestValueFromArray() {
214
+        int expected = 10;
215
+        assertEquals(expected, Arraz.find2ndLargestValueFromArray(ints2));
216
+    }
217
+
218
+    @Test
219
+    public void test2Find2NdLargestValueFromArray() {
220
+        int expected = -7;
221
+        assertEquals(expected, Arraz.find2ndLargestValueFromArray(ints));
222
+    }
223
+
224
+    @Test
225
+    public void testMakeMeAnArrayListFromArray() {
226
+        ArrayList<Integer> arrayList = new ArrayList<Integer>(Arrays.asList(ints2));
227
+        assertEquals(arrayList, Arraz.makeMeAnArrayListFromArray(ints2));
228
+    }
229
+
230
+    @Test
231
+    public void test2MakeMeAnArrayListFromArray() {
232
+        ArrayList<Integer> arrayList = new ArrayList<Integer>(Arrays.asList(ints));
233
+        assertEquals(arrayList, Arraz.makeMeAnArrayListFromArray(ints));
234
+    }
235
+
236
+    @Test
237
+    public void test1MakeMeAnArrayFromArrayList() {
238
+        ArrayList<Integer> arrayList = Arraz.makeMeAnArrayListFromArray(ints);
239
+        assertEquals(ints, Arraz.makeMeAnArrayFromArrayList(arrayList));
240
+    }
195
 
241
 
242
+    @Test
243
+    public void test2MakeMeAnArrayFromArrayList() {
244
+        ArrayList<Integer> arrayList = Arraz.makeMeAnArrayListFromArray(ints2);
245
+        assertEquals(ints2, Arraz.makeMeAnArrayFromArrayList(arrayList));
246
+    }
247
+
248
+    @Test
249
+    public void test1check2ArraysForEqual() {
250
+        assertTrue(Arraz.check2ArraysForEqual(ints, ints));
251
+    }
252
+
253
+    @Test
254
+    public void test2check2ArraysForEqual() {
255
+        assertFalse(Arraz.check2ArraysForEqual(ints, ints2));
256
+    }
257
+
258
+    @Test
259
+    public void test1AverageArrayWithoutMaxMin() {
260
+        int expected = 10;
261
+        assertEquals(expected, Arraz.averageArrayWithoutMaxMin(ints2));
262
+    }
263
+
264
+    @Test
265
+    public void test2AverageArrayWithoutMaxMin() {
266
+        int expected = 17;
267
+        assertEquals(expected, Arraz.averageArrayWithoutMaxMin(ints));
268
+    }
269
+
270
+    @Test
271
+    public void test1ArrayHas65and77() {
272
+        assertFalse(Arraz.arrayHas65and77(ints2));
273
+    }
274
+
275
+    @Test
276
+    public void test2ArrayHas65and77() {
277
+        Integer[] arr = {65, 77};
278
+        assertTrue(Arraz.arrayHas65and77(arr));
279
+    }
280
+
281
+    @Test
282
+    public void test1theTotalOfTensIs30() {
283
+        assertFalse(Arraz.theTotalOfTensIs30(ints));
196
     }
284
     }
197
 
285
 
286
+    @Test
287
+    public void test2theTotalOfTensIs30() {
288
+        Integer[] arr = {10, 10, 10};
289
+        assertTrue(Arraz.theTotalOfTensIs30(arr));
290
+    }
291
+
292
+    @Test
293
+    public void test1find2Smallest() {
294
+        TwoSmallest smallest = new TwoSmallest(0, 1);
295
+        Integer[] arr = {0, 1};
296
+        assertEquals(smallest.getSmallest(), Arraz.find2Smallest(arr).getSmallest());
297
+    }
298
+
299
+    @Test(expected = NullPointerException.class)
300
+    public void test2Find2Smallest() {
301
+        Integer[] arr = {};
302
+        Arraz.find2Smallest(arr);
303
+        assertEquals(0, Arraz.find2Smallest(arr).getSecond_smallest());
304
+
305
+        /* refactor to handle this */
306
+    }
307
+
308
+    @Test
309
+    public void test1MakeMeACopyPlease() {
310
+        Integer[] exp = Arraz.reverseArray(ints);
311
+        assertEquals(exp, Arraz.makeMeACopyPlease(ints));
312
+    }
313
+
314
+    @Test
315
+    public void test2MakeMeACopyPlease() {
316
+        Integer[] exp = Arraz.reverseArray(ints2);
317
+        assertEquals(exp, Arraz.makeMeACopyPlease(ints2));
318
+    }
319
+
320
+    @Test
321
+    public void test1removeLastItemAndCopy() {
322
+        Integer[] exp = {6, 10};
323
+        assertEquals(exp, Arraz.removeLastItemAndCopy(ints2));
324
+    }
325
+
326
+    @Test
327
+    public void test2RemoveLastItemAndCopy() {
328
+        Integer[] exp = {4,5,102,6,-7,12,-32,92};
329
+        assertEquals(exp, Arraz.removeLastItemAndCopy(ints));
330
+    }
331
+
332
+    @Test
333
+    public void test1RemoveFirstItemAndCopy() {
334
+        Integer[] exp = {10, 31};
335
+        assertEquals(exp, Arraz.removeFirstItemAndCopy(ints2));
336
+    }
337
+
338
+    @Test
339
+    public void test2RemoveFirstItemAndCopy() {
340
+        Integer[] exp = {5,102,6,-7,12,-32,92,8};
341
+        assertEquals(exp, Arraz.removeFirstItemAndCopy(ints));
342
+    }
343
+
344
+    @Test
345
+    public void test1InsertAtStartAndCopy() {
346
+        Integer[] exp = {1, 4, 5,102,6,-7,12,-32,92,8};
347
+        Integer[] actual = Arraz.insertAtStartAndCopy(ints, 1);
348
+        assertEquals(exp, actual);
349
+    }
350
+
351
+    @Test
352
+    public void test2InsertAtStartAndCopy() {
353
+        Integer[] exp = {5, 6, 10, 31};
354
+        assertEquals(exp, Arraz.insertAtStartAndCopy(ints2,5));
355
+    }
356
+
357
+    @Test
358
+    public void test1InsertAtEndAndCopy() {
359
+        Integer[] exp = {4, 5,102,6,-7,12,-32,92,8, 1};
360
+        assertEquals(exp, Arraz.insertAtEndAndCopy(ints, 1));
361
+    }
362
+
363
+    @Test
364
+    public void test2InsertAtEndAndCopy() {
365
+        Integer[] exp = {6, 10, 31, 5};
366
+        assertEquals(exp, Arraz.insertAtEndAndCopy(ints2, 5));
367
+    }
368
+
369
+    @Test
370
+    public void test1sortArrayIntoEvensThenOdds() {
371
+        Integer[] exp = {6, 10, 31};
372
+        assertEquals(exp, Arraz.sortArrayIntoEvensThenOdds(ints2));
373
+    }
374
+
375
+    @Test
376
+    public void test2SortArrayIntoEvensThenodds() {
377
+        Integer[] exp = {4, 102, 6, 12, -32, 92, 8, 5, -7};
378
+        assertEquals(exp, Arraz.sortArrayIntoEvensThenOdds(ints));
379
+    }
198
 }
380
 }