Browse Source

up to MaxMin

Nathan Hall 6 years ago
parent
commit
f411e7c248
3 changed files with 408 additions and 82 deletions
  1. 122
    74
      arraz/.idea/workspace.xml
  2. 128
    6
      arraz/src/main/java/Arraz.java
  3. 158
    2
      arraz/src/test/java/ArrazTest.java

+ 122
- 74
arraz/.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="81f99a04-35ff-49d0-a7a5-4ed795a161d6" name="Default Changelist" comment="">
4
     <list default="true" id="81f99a04-35ff-49d0-a7a5-4ed795a161d6" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
5
       <change beforePath="$PROJECT_DIR$/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Arraz.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Arraz.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/ArrazTest.java" afterDir="false" />
7
       <change beforePath="$PROJECT_DIR$/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/ArrazTest.java" afterDir="false" />
7
     </list>
8
     </list>
22
       </usages-collector>
23
       </usages-collector>
23
       <usages-collector id="statistics.file.types.open">
24
       <usages-collector id="statistics.file.types.open">
24
         <counts>
25
         <counts>
25
-          <entry key="JAVA" value="3" />
26
+          <entry key="JAVA" value="6" />
26
         </counts>
27
         </counts>
27
       </usages-collector>
28
       </usages-collector>
28
       <usages-collector id="statistics.file.types.edit">
29
       <usages-collector id="statistics.file.types.edit">
29
         <counts>
30
         <counts>
30
-          <entry key="JAVA" value="1519" />
31
+          <entry key="JAVA" value="3847" />
31
         </counts>
32
         </counts>
32
       </usages-collector>
33
       </usages-collector>
33
     </session>
34
     </session>
34
   </component>
35
   </component>
35
   <component name="FileEditorManager">
36
   <component name="FileEditorManager">
36
-    <splitter split-orientation="horizontal" split-proportion="0.5">
37
+    <splitter split-orientation="horizontal" split-proportion="0.5571332">
37
       <split-first>
38
       <split-first>
38
         <leaf>
39
         <leaf>
39
           <file pinned="false" current-in-tab="true">
40
           <file pinned="false" current-in-tab="true">
40
             <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
41
             <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
41
               <provider selected="true" editor-type-id="text-editor">
42
               <provider selected="true" editor-type-id="text-editor">
42
-                <state relative-caret-position="349">
43
-                  <caret line="82" column="4" lean-forward="true" selection-start-line="82" selection-start-column="4" selection-end-line="82" selection-end-column="4" />
43
+                <state relative-caret-position="550">
44
+                  <caret line="197" column="16" lean-forward="true" selection-start-line="197" selection-start-column="16" selection-end-line="197" selection-end-column="16" />
44
                   <folding>
45
                   <folding>
45
-                    <element signature="e#1253#1254#0" expanded="true" />
46
-                    <element signature="e#1288#1289#0" expanded="true" />
47
-                    <element signature="e#1321#1322#0" expanded="true" />
48
-                    <element signature="e#1357#1358#0" expanded="true" />
46
+                    <element signature="imports" expanded="true" />
47
+                    <element signature="e#1375#1376#0" expanded="true" />
48
+                    <element signature="e#1410#1411#0" expanded="true" />
49
+                    <element signature="e#1454#1455#0" expanded="true" />
50
+                    <element signature="e#1490#1491#0" expanded="true" />
51
+                    <element signature="e#3458#3459#0" expanded="true" />
52
+                    <element signature="e#3492#3493#0" expanded="true" />
53
+                    <element signature="e#3523#3524#0" expanded="true" />
54
+                    <element signature="e#3557#3558#0" expanded="true" />
55
+                    <element signature="e#3596#3597#0" expanded="true" />
56
+                    <element signature="e#3634#3635#0" expanded="true" />
57
+                    <element signature="e#3673#3674#0" expanded="true" />
58
+                    <element signature="e#3711#3712#0" expanded="true" />
49
                   </folding>
59
                   </folding>
50
                 </state>
60
                 </state>
51
               </provider>
61
               </provider>
58
           <file pinned="false" current-in-tab="true">
68
           <file pinned="false" current-in-tab="true">
59
             <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
69
             <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
60
               <provider selected="true" editor-type-id="text-editor">
70
               <provider selected="true" editor-type-id="text-editor">
61
-                <state relative-caret-position="334">
62
-                  <caret line="151" column="36" selection-start-line="151" selection-start-column="36" selection-end-line="151" selection-end-column="36" />
71
+                <state relative-caret-position="73">
72
+                  <caret line="292" column="49" selection-start-line="292" selection-start-column="49" selection-end-line="292" selection-end-column="49" />
63
                   <folding>
73
                   <folding>
64
                     <element signature="imports" expanded="true" />
74
                     <element signature="imports" expanded="true" />
65
                   </folding>
75
                   </folding>
89
     <sorting>DEFINITION_ORDER</sorting>
99
     <sorting>DEFINITION_ORDER</sorting>
90
   </component>
100
   </component>
91
   <component name="ProjectFrameBounds">
101
   <component name="ProjectFrameBounds">
92
-    <option name="x" value="-235" />
93
-    <option name="y" value="-917" />
94
-    <option name="width" value="1781" />
95
-    <option name="height" value="817" />
102
+    <option name="x" value="-332" />
103
+    <option name="y" value="-934" />
104
+    <option name="width" value="1636" />
105
+    <option name="height" value="793" />
96
   </component>
106
   </component>
97
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
107
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
98
   <component name="ProjectView">
108
   <component name="ProjectView">
149
   <component name="PropertiesComponent">
159
   <component name="PropertiesComponent">
150
     <property name="WebServerToolWindowFactoryState" value="false" />
160
     <property name="WebServerToolWindowFactoryState" value="false" />
151
     <property name="aspect.path.notification.shown" value="true" />
161
     <property name="aspect.path.notification.shown" value="true" />
152
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544051412169" />
162
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544142759655" />
153
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
163
     <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
154
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
164
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
155
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
165
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
166
       </list>
176
       </list>
167
     </option>
177
     </option>
168
   </component>
178
   </component>
169
-  <component name="RunManager" selected="JUnit.ArrazTest">
170
-    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
179
+  <component name="RunManager" selected="JUnit.ArrazTest.test2FindMaxMinOfArray">
180
+    <configuration name="ArrazTest.test2FindMaxMinOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
171
       <module name="arraz" />
181
       <module name="arraz" />
172
       <option name="PACKAGE_NAME" value="" />
182
       <option name="PACKAGE_NAME" value="" />
173
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
183
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
184
+      <option name="METHOD_NAME" value="test2FindMaxMinOfArray" />
185
+      <option name="TEST_OBJECT" value="method" />
174
       <method v="2">
186
       <method v="2">
175
         <option name="Make" enabled="true" />
187
         <option name="Make" enabled="true" />
176
       </method>
188
       </method>
177
     </configuration>
189
     </configuration>
178
-    <configuration name="ArrazTest.test1ReverseArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
190
+    <configuration name="ArrazTest.test2InsertIntoArrayAt" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
179
       <module name="arraz" />
191
       <module name="arraz" />
180
       <option name="PACKAGE_NAME" value="" />
192
       <option name="PACKAGE_NAME" value="" />
181
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
193
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
182
-      <option name="METHOD_NAME" value="test1ReverseArray" />
194
+      <option name="METHOD_NAME" value="test2InsertIntoArrayAt" />
183
       <option name="TEST_OBJECT" value="method" />
195
       <option name="TEST_OBJECT" value="method" />
184
       <method v="2">
196
       <method v="2">
185
         <option name="Make" enabled="true" />
197
         <option name="Make" enabled="true" />
186
       </method>
198
       </method>
187
     </configuration>
199
     </configuration>
188
-    <configuration name="ArrazTest.test2ContainsValue" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
200
+    <configuration name="ArrazTest.test2RemoveElementFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
189
       <module name="arraz" />
201
       <module name="arraz" />
190
       <option name="PACKAGE_NAME" value="" />
202
       <option name="PACKAGE_NAME" value="" />
191
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
203
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
192
-      <option name="METHOD_NAME" value="test2ContainsValue" />
204
+      <option name="METHOD_NAME" value="test2RemoveElementFromArray" />
193
       <option name="TEST_OBJECT" value="method" />
205
       <option name="TEST_OBJECT" value="method" />
194
       <method v="2">
206
       <method v="2">
195
         <option name="Make" enabled="true" />
207
         <option name="Make" enabled="true" />
196
       </method>
208
       </method>
197
     </configuration>
209
     </configuration>
198
-    <configuration name="ArrazTest.test2DoubleAverageOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
210
+    <configuration name="ArrazTest.testFindMaxMinOfArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
199
       <module name="arraz" />
211
       <module name="arraz" />
200
       <option name="PACKAGE_NAME" value="" />
212
       <option name="PACKAGE_NAME" value="" />
201
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
213
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
202
-      <option name="METHOD_NAME" value="test2DoubleAverageOfArray" />
214
+      <option name="METHOD_NAME" value="testFindMaxMinOfArray" />
203
       <option name="TEST_OBJECT" value="method" />
215
       <option name="TEST_OBJECT" value="method" />
204
       <method v="2">
216
       <method v="2">
205
         <option name="Make" enabled="true" />
217
         <option name="Make" enabled="true" />
206
       </method>
218
       </method>
207
     </configuration>
219
     </configuration>
208
-    <configuration name="ArrazTest.test2ReverseArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
220
+    <configuration name="ArrazTest.testInsertIntoArrayAt" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
209
       <module name="arraz" />
221
       <module name="arraz" />
210
       <option name="PACKAGE_NAME" value="" />
222
       <option name="PACKAGE_NAME" value="" />
211
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
223
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
212
-      <option name="METHOD_NAME" value="test2ReverseArray" />
224
+      <option name="METHOD_NAME" value="testInsertIntoArrayAt" />
213
       <option name="TEST_OBJECT" value="method" />
225
       <option name="TEST_OBJECT" value="method" />
214
       <method v="2">
226
       <method v="2">
215
         <option name="Make" enabled="true" />
227
         <option name="Make" enabled="true" />
216
       </method>
228
       </method>
217
     </configuration>
229
     </configuration>
218
     <list>
230
     <list>
219
-      <item itemvalue="JUnit.ArrazTest.test2ContainsValue" />
220
-      <item itemvalue="JUnit.ArrazTest.test1ReverseArray" />
221
-      <item itemvalue="JUnit.ArrazTest.test2ReverseArray" />
222
-      <item itemvalue="JUnit.ArrazTest" />
223
-      <item itemvalue="JUnit.ArrazTest.test2DoubleAverageOfArray" />
231
+      <item itemvalue="JUnit.ArrazTest.test2RemoveElementFromArray" />
232
+      <item itemvalue="JUnit.ArrazTest.testInsertIntoArrayAt" />
233
+      <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
234
+      <item itemvalue="JUnit.ArrazTest.testFindMaxMinOfArray" />
235
+      <item itemvalue="JUnit.ArrazTest.test2FindMaxMinOfArray" />
224
     </list>
236
     </list>
225
     <recent_temporary>
237
     <recent_temporary>
226
       <list>
238
       <list>
227
-        <item itemvalue="JUnit.ArrazTest" />
228
-        <item itemvalue="JUnit.ArrazTest.test2DoubleAverageOfArray" />
229
-        <item itemvalue="JUnit.ArrazTest.test2ReverseArray" />
230
-        <item itemvalue="JUnit.ArrazTest.test1ReverseArray" />
231
-        <item itemvalue="JUnit.ArrazTest.test2ContainsValue" />
239
+        <item itemvalue="JUnit.ArrazTest.test2FindMaxMinOfArray" />
240
+        <item itemvalue="JUnit.ArrazTest.testFindMaxMinOfArray" />
241
+        <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
242
+        <item itemvalue="JUnit.ArrazTest.testInsertIntoArrayAt" />
243
+        <item itemvalue="JUnit.ArrazTest.test2RemoveElementFromArray" />
232
       </list>
244
       </list>
233
     </recent_temporary>
245
     </recent_temporary>
234
   </component>
246
   </component>
242
       <option name="number" value="Default" />
254
       <option name="number" value="Default" />
243
       <option name="presentableId" value="Default" />
255
       <option name="presentableId" value="Default" />
244
       <updated>1544046001151</updated>
256
       <updated>1544046001151</updated>
245
-      <workItem from="1544046022231" duration="5261000" />
257
+      <workItem from="1544046022231" duration="18399000" />
246
     </task>
258
     </task>
247
     <servers />
259
     <servers />
248
   </component>
260
   </component>
249
   <component name="TestHistory">
261
   <component name="TestHistory">
250
-    <history-entry file="ArrazTest_test1ReverseArray - 2018.12.05 at 17h 24m 39s.xml">
251
-      <configuration name="ArrazTest.test1ReverseArray" configurationId="JUnit" />
262
+    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 21m 09s.xml">
263
+      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
252
     </history-entry>
264
     </history-entry>
253
-    <history-entry file="ArrazTest_test1ReverseArray - 2018.12.05 at 17h 35m 52s.xml">
254
-      <configuration name="ArrazTest.test1ReverseArray" configurationId="JUnit" />
265
+    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 19h 22m 09s.xml">
266
+      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
255
     </history-entry>
267
     </history-entry>
256
-    <history-entry file="ArrazTest_test1ReverseArray - 2018.12.05 at 17h 36m 18s.xml">
257
-      <configuration name="ArrazTest.test1ReverseArray" configurationId="JUnit" />
268
+    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 19h 23m 02s.xml">
269
+      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
258
     </history-entry>
270
     </history-entry>
259
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 40m 35s.xml">
260
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
271
+    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 23m 30s.xml">
272
+      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
261
     </history-entry>
273
     </history-entry>
262
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 41m 55s.xml">
263
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
274
+    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 23m 50s.xml">
275
+      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
264
     </history-entry>
276
     </history-entry>
265
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 42m 17s.xml">
266
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
277
+    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 19h 28m 37s.xml">
278
+      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
267
     </history-entry>
279
     </history-entry>
268
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 50m 11s.xml">
269
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
280
+    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 28m 45s.xml">
281
+      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
270
     </history-entry>
282
     </history-entry>
271
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 55m 19s.xml">
272
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
283
+    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 19h 30m 52s.xml">
284
+      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
273
     </history-entry>
285
     </history-entry>
274
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 56m 34s.xml">
275
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
286
+    <history-entry file="ArrazTest_testFindMaxMinOfArray - 2018.12.06 at 19h 32m 29s.xml">
287
+      <configuration name="ArrazTest.testFindMaxMinOfArray" configurationId="JUnit" />
276
     </history-entry>
288
     </history-entry>
277
-    <history-entry file="ArrazTest_test2ReverseArray - 2018.12.05 at 17h 56m 47s.xml">
278
-      <configuration name="ArrazTest.test2ReverseArray" configurationId="JUnit" />
289
+    <history-entry file="ArrazTest_test2FindMaxMinOfArray - 2018.12.06 at 19h 32m 40s.xml">
290
+      <configuration name="ArrazTest.test2FindMaxMinOfArray" configurationId="JUnit" />
279
     </history-entry>
291
     </history-entry>
280
   </component>
292
   </component>
281
   <component name="TimeTrackingManager">
293
   <component name="TimeTrackingManager">
282
-    <option name="totallyTimeSpent" value="5261000" />
294
+    <option name="totallyTimeSpent" value="18399000" />
283
   </component>
295
   </component>
284
   <component name="ToolWindowManager">
296
   <component name="ToolWindowManager">
285
-    <frame x="-236" y="-893" width="1781" height="817" extended-state="0" />
297
+    <frame x="-332" y="-934" width="1636" height="793" extended-state="0" />
286
     <editor active="true" />
298
     <editor active="true" />
287
     <layout>
299
     <layout>
288
       <window_info id="Image Layers" />
300
       <window_info id="Image Layers" />
290
       <window_info id="UI Designer" />
302
       <window_info id="UI Designer" />
291
       <window_info id="Capture Tool" />
303
       <window_info id="Capture Tool" />
292
       <window_info id="Favorites" side_tool="true" />
304
       <window_info id="Favorites" side_tool="true" />
293
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.11673375" />
305
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.072145544" />
294
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
306
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
295
-      <window_info anchor="bottom" id="Messages" weight="0.32905984" />
307
+      <window_info anchor="bottom" id="Messages" weight="0.3259587" />
296
       <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
308
       <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
297
       <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
309
       <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
298
-      <window_info anchor="bottom" id="Terminal" weight="0.32905984" />
310
+      <window_info anchor="bottom" id="Terminal" weight="0.3649289" />
299
       <window_info anchor="bottom" id="Event Log" side_tool="true" />
311
       <window_info anchor="bottom" id="Event Log" side_tool="true" />
300
       <window_info anchor="bottom" id="Message" order="0" />
312
       <window_info anchor="bottom" id="Message" order="0" />
301
       <window_info anchor="bottom" id="Find" order="1" />
313
       <window_info anchor="bottom" id="Find" order="1" />
302
-      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32905984" />
303
-      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
314
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.40855458" />
315
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.39810428" />
304
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
316
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
305
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
317
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
306
       <window_info anchor="bottom" id="TODO" order="6" />
318
       <window_info anchor="bottom" id="TODO" order="6" />
322
     <option name="myLimit" value="2678400000" />
334
     <option name="myLimit" value="2678400000" />
323
   </component>
335
   </component>
324
   <component name="editorHistoryManager">
336
   <component name="editorHistoryManager">
325
-    <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
337
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/io/PrintStream.java">
326
       <provider selected="true" editor-type-id="text-editor">
338
       <provider selected="true" editor-type-id="text-editor">
327
-        <state relative-caret-position="334">
328
-          <caret line="151" column="36" selection-start-line="151" selection-start-column="36" selection-end-line="151" selection-end-column="36" />
339
+        <state relative-caret-position="111">
340
+          <caret line="596" selection-start-line="596" selection-end-line="596" />
329
           <folding>
341
           <folding>
330
-            <element signature="imports" expanded="true" />
342
+            <element signature="e#20871#20872#0" expanded="true" />
343
+          </folding>
344
+        </state>
345
+      </provider>
346
+    </entry>
347
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/lang/String.java">
348
+      <provider selected="true" editor-type-id="text-editor">
349
+        <state relative-caret-position="118">
350
+          <caret line="3098" selection-start-line="3098" selection-end-line="3098" />
351
+          <folding>
352
+            <element signature="e#121769#121770#0" expanded="true" />
331
           </folding>
353
           </folding>
332
         </state>
354
         </state>
333
       </provider>
355
       </provider>
334
     </entry>
356
     </entry>
357
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/src.zip!/java/lang/Integer.java">
358
+      <provider selected="true" editor-type-id="text-editor">
359
+        <state relative-caret-position="148">
360
+          <caret line="399" selection-start-line="399" selection-end-line="399" />
361
+        </state>
362
+      </provider>
363
+    </entry>
335
     <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
364
     <entry file="file://$PROJECT_DIR$/src/main/java/Arraz.java">
336
       <provider selected="true" editor-type-id="text-editor">
365
       <provider selected="true" editor-type-id="text-editor">
337
-        <state relative-caret-position="349">
338
-          <caret line="82" column="4" lean-forward="true" selection-start-line="82" selection-start-column="4" selection-end-line="82" selection-end-column="4" />
366
+        <state relative-caret-position="550">
367
+          <caret line="197" column="16" lean-forward="true" selection-start-line="197" selection-start-column="16" selection-end-line="197" selection-end-column="16" />
339
           <folding>
368
           <folding>
340
-            <element signature="e#1253#1254#0" expanded="true" />
341
-            <element signature="e#1288#1289#0" expanded="true" />
342
-            <element signature="e#1321#1322#0" expanded="true" />
343
-            <element signature="e#1357#1358#0" expanded="true" />
369
+            <element signature="imports" expanded="true" />
370
+            <element signature="e#1375#1376#0" expanded="true" />
371
+            <element signature="e#1410#1411#0" expanded="true" />
372
+            <element signature="e#1454#1455#0" expanded="true" />
373
+            <element signature="e#1490#1491#0" expanded="true" />
374
+            <element signature="e#3458#3459#0" expanded="true" />
375
+            <element signature="e#3492#3493#0" expanded="true" />
376
+            <element signature="e#3523#3524#0" expanded="true" />
377
+            <element signature="e#3557#3558#0" expanded="true" />
378
+            <element signature="e#3596#3597#0" expanded="true" />
379
+            <element signature="e#3634#3635#0" expanded="true" />
380
+            <element signature="e#3673#3674#0" expanded="true" />
381
+            <element signature="e#3711#3712#0" expanded="true" />
382
+          </folding>
383
+        </state>
384
+      </provider>
385
+    </entry>
386
+    <entry file="file://$PROJECT_DIR$/src/test/java/ArrazTest.java">
387
+      <provider selected="true" editor-type-id="text-editor">
388
+        <state relative-caret-position="73">
389
+          <caret line="292" column="49" selection-start-line="292" selection-start-column="49" selection-end-line="292" selection-end-column="49" />
390
+          <folding>
391
+            <element signature="imports" expanded="true" />
344
           </folding>
392
           </folding>
345
         </state>
393
         </state>
346
       </provider>
394
       </provider>

+ 128
- 6
arraz/src/main/java/Arraz.java View File

1
+import java.util.ArrayList;
2
+import java.util.Arrays;
3
+import java.util.Iterator;
4
+import java.util.List;
5
+
1
 public class Arraz {
6
 public class Arraz {
2
 
7
 
3
     public int sumValuesOfArray(int[] arr) {
8
     public int sumValuesOfArray(int[] arr) {
49
 
54
 
50
     public boolean containsValue(int[] arr, int value) {
55
     public boolean containsValue(int[] arr, int value) {
51
 
56
 
52
-        for (int i : arr){
53
-            if ( i == value){
57
+        for (int i : arr) {
58
+            if (i == value) {
54
                 return true;
59
                 return true;
55
             }
60
             }
56
         }
61
         }
61
     public int[] reverseArray(int[] array1) {
66
     public int[] reverseArray(int[] array1) {
62
         int[] array2 = new int[array1.length];
67
         int[] array2 = new int[array1.length];
63
 
68
 
64
-        for (int i = 0; i < array1.length; i++){
69
+        for (int i = 0; i < array1.length; i++) {
65
             array2[array1.length - 1 - i] = array1[i];
70
             array2[array1.length - 1 - i] = array1[i];
66
         }
71
         }
67
 
72
 
68
         return array2;
73
         return array2;
69
     }
74
     }
70
 
75
 
71
-    public class OddEven{
76
+    public int[] insertIntoArray(int[] array, int pos, int value) {
77
+
78
+        int[] arr = new int[array.length + 1];
79
+        int count = 0;
80
+
81
+        for (int i = 0; i < array.length; i++) {
82
+            if( i == pos - 1 ){
83
+                arr[count] = value;
84
+                count++;
85
+            }
86
+
87
+            arr[count] = array[i];
88
+            count++;
89
+        }
90
+        return arr;
91
+    }
92
+
93
+    public class OddEven {
72
         public int odds;
94
         public int odds;
73
         public int evens;
95
         public int evens;
74
 
96
 
75
-        public int getOdds() {
97
+        public int getOdds(int[] array) {
76
             return odds;
98
             return odds;
77
         }
99
         }
78
 
100
 
79
-        public int getEvens() {
101
+        public int getEvens(int[] array) {
80
             return evens;
102
             return evens;
81
         }
103
         }
104
+
105
+
106
+        public void getOddEvensOfArray(int[] array1) {
107
+            for (int i : array1) {
108
+                if (i % 2 == 0) {
109
+                    evens += 1;
110
+                } else {
111
+                    odds += 1;
112
+                }
113
+            }
114
+        }
115
+    }
116
+
117
+    public Integer[] copyArrayByIterator(Integer[] array1) {
118
+
119
+        int i = 0;
120
+        Integer[] newArr = new Integer[array1.length];
121
+        Iterator<Integer> iterator = Arrays.asList(array1).iterator();
122
+
123
+        while (iterator.hasNext()) {
124
+            newArr[i] = iterator.next();
125
+            i++;
126
+        }
127
+        return newArr;
128
+    }
129
+
130
+
131
+    public int findIndexOf(int[] array1, int value) {
132
+        int count = 0;
133
+        for (int i : array1) {
134
+            if (i == value) {
135
+                return count;
136
+            }
137
+            count++;
138
+        }
139
+        System.out.println("Value of " + value + " does not exist");
140
+        return -1;
141
+    }
142
+
143
+    public Integer[] copyArrayByLoop(Integer[] array3) {
144
+        Integer[] intArr = new Integer[array3.length];
145
+
146
+        for (int j = 0; j < array3.length; j++) {
147
+            intArr[j] = array3[j];
148
+        }
149
+        return intArr;
150
+    }
151
+
152
+    public Integer[] removeElementFromArray(Integer[] array, Integer value) {
153
+        Integer[] arr = new Integer[array.length-1];
154
+        int count = 0;
155
+        for (Integer i: array){
156
+            if (i != value){
157
+                arr[count] = i;
158
+                count++;
159
+            }
160
+        }
161
+        return arr;
82
     }
162
     }
83
 
163
 
84
 
164
 
165
+    public class MaxMin {
166
+        public int max;
167
+        public int min;
85
 
168
 
169
+        public int getMax() {
170
+            return max;
171
+        }
172
+
173
+        public int getMin() {
174
+            return min;
175
+        }
176
+
177
+        public void setMax(int max) {
178
+            this.max = max;
179
+        }
180
+
181
+        public void setMin(int min) {
182
+            this.min = min;
183
+        }
184
+    }
185
+
186
+    public MaxMin findMaxMinOfArray(int[] array) {
187
+        MaxMin mn = new MaxMin();
188
+
189
+        mn.max = array[0];
190
+        mn.min = array[0];
191
+
192
+        for (int i : array){
193
+            if ( i > mn.getMax() ){
194
+                mn.setMax(i);
195
+            }
196
+
197
+            if ( i < mn.getMin() ){
198
+                mn.setMin(i);
199
+            }
200
+
201
+            System.out.println("Max is: " + mn.max);
202
+            System.out.println("Min is: " + mn.min);
203
+        }
204
+
205
+        return mn;
206
+
207
+    }
86
 }
208
 }

+ 158
- 2
arraz/src/test/java/ArrazTest.java View File

144
 
144
 
145
     @Test
145
     @Test
146
     public void testGetOddEvensOfArray(){
146
     public void testGetOddEvensOfArray(){
147
+        Arraz.OddEven oe = arraz.new OddEven();
147
 
148
 
149
+        int expected = 3;
150
+        oe.getOddEvensOfArray(array1);
148
 
151
 
149
-        int[] expected = {1,2,3,4,5};
150
-        int[] actual = arraz.reverseArray(array2);
152
+        Assert.assertEquals(expected, oe.getOdds(array1));
153
+
154
+    }
155
+
156
+    @Test
157
+    public void test2GetOddEvensOfArray(){
158
+        Arraz.OddEven oe = arraz.new OddEven();
159
+
160
+        int expected = 2;
161
+        oe.getOddEvensOfArray(array1);
162
+
163
+        Assert.assertEquals(expected, oe.getEvens(array1));
164
+
165
+    }
166
+
167
+    @Test
168
+    public void testFindIndexOf(){
169
+
170
+        int value = 3;
171
+        int expected = 2;
172
+        int actual = arraz.findIndexOf(array1, value);
173
+
174
+        Assert.assertEquals(expected, actual);
175
+
176
+    }
177
+
178
+    @Test
179
+    public void test2FindIndexOf(){
180
+
181
+        int value = 7;
182
+        int expected = -1;
183
+        int actual = arraz.findIndexOf(array1, value);
184
+
185
+        Assert.assertEquals(expected, actual);
186
+
187
+    }
188
+
189
+    Integer[] array3 = {1,2,3,4,5};
190
+
191
+    @Test
192
+    public void testCopyArrayByIterator(){
193
+
194
+        Integer[] expected = {1,2,3,4,5};
195
+        Integer[] actual = arraz.copyArrayByIterator(array3);
196
+
197
+        Assert.assertTrue(Arrays.equals(expected, actual));
198
+
199
+    }
200
+
201
+    Integer[] array4 = {1};
202
+    @Test
203
+    public void test2CopyArrayByIterator(){
204
+
205
+        Integer[] expected = {1};
206
+        Integer[] actual = arraz.copyArrayByIterator(array4);
207
+
208
+        Assert.assertTrue(Arrays.equals(expected, actual));
209
+
210
+    }
211
+
212
+    @Test
213
+    public void testCopyArrayByLoop(){
214
+
215
+        Integer[] expected = {1,2,3,4,5};
216
+        Integer[] actual = arraz.copyArrayByLoop(array3);
217
+
218
+        Assert.assertTrue(Arrays.equals(expected, actual));
219
+
220
+    }
221
+
222
+    @Test
223
+    public void test2CopyArrayByLoop(){
224
+        Integer[] array3 = {-1};
151
 
225
 
226
+        Integer[] expected = {-1};
227
+        Integer[] actual = arraz.copyArrayByLoop(array3);
152
 
228
 
229
+        Assert.assertTrue(Arrays.equals(expected, actual));
153
 
230
 
154
     }
231
     }
155
 
232
 
233
+    @Test
234
+    public void testRemoveElementFromArray(){
235
+        Integer[] array = {1,2,3,4,5};
236
+        Integer value = 3;
237
+
238
+        Integer[] expected = {1,2,4,5};
239
+        Integer[] actual = arraz.removeElementFromArray(array, value);
240
+
241
+        Assert.assertTrue(Arrays.equals(expected, actual));
242
+
243
+    }
244
+
245
+    @Test
246
+    public void test2RemoveElementFromArray() {
247
+        Integer[] array = {1};
248
+        Integer value = 1;
249
+
250
+        Integer[] expected = {};
251
+        Integer[] actual = arraz.removeElementFromArray(array, value);
252
+
253
+        Assert.assertTrue(Arrays.equals(expected, actual));
254
+
255
+    }
256
+
257
+    @Test
258
+    public void testInsertIntoArrayAt() {
259
+        int pos = 3;
260
+        int value = 4;
261
+        int[] array = {1,2,3,4,5};
262
+
263
+
264
+        int[] expected = {1,2,4,3,4,5};
265
+        int[] actual = arraz.insertIntoArray(array, pos, value);
266
+
267
+        Assert.assertTrue(Arrays.equals(expected, actual));
268
+    }
269
+
270
+    @Test
271
+    public void test2InsertIntoArrayAt() {
272
+        int pos = 1;
273
+        int value = 4;
274
+        int[] array = {1,2,3,4,5};
275
+
276
+
277
+        int[] expected = {4,1,2,3,4,5};
278
+        int[] actual = arraz.insertIntoArray(array, pos, value);
279
+
280
+        Assert.assertTrue(Arrays.equals(expected, actual));
281
+    }
282
+
283
+    @Test
284
+    public void testFindMaxMinOfArray(){
285
+
286
+        int[] array = {1,5,2,4,3};
287
+        int expected = 5;
288
+
289
+        Arraz.MaxMin mn = arraz.new MaxMin();
290
+
291
+        arraz.findMaxMinOfArray(array);
292
+
293
+        Assert.assertEquals(expected, mn.getMax());
294
+
295
+    }
296
+
297
+    @Test
298
+    public void test2FindMaxMinOfArray(){
299
+
300
+        int[] array = {1,5,2,-1,0};
301
+        int expected = -1;
302
+
303
+        Arraz.MaxMin mn = arraz.new MaxMin();
304
+
305
+        arraz.findMaxMinOfArray(array);
306
+
307
+        Assert.assertEquals(expected, mn.getMin());
308
+
309
+    }
310
+
311
+
156
 }
312
 }