Browse Source

in progress

thulasi 6 years ago
parent
commit
e5f58ab730
5 changed files with 235 additions and 84 deletions
  1. 73
    67
      .idea/workspace.xml
  2. 1
    1
      arraz/arraz.iml
  3. 12
    0
      arraz/pom.xml
  4. 51
    16
      arraz/src/main/java/Arraz.java
  5. 98
    0
      arraz/src/test/java/ArrazTest.java

+ 73
- 67
.idea/workspace.xml View File

@@ -2,11 +2,9 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/MaxMin.java" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/arraz/src/main/java/OddEven.java" afterDir="false" />
7
-      <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
8
-      <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9 5
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/arraz/arraz.iml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/arraz.iml" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/arraz/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/pom.xml" afterDir="false" />
10 8
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
11 9
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
12 10
     </list>
@@ -21,30 +19,31 @@
21 19
     <session id="458231039">
22 20
       <usages-collector id="statistics.lifecycle.project">
23 21
         <counts>
24
-          <entry key="project.closed" value="1" />
22
+          <entry key="project.closed" value="2" />
23
+          <entry key="project.open.time.13" value="1" />
25 24
           <entry key="project.open.time.15" value="1" />
26 25
           <entry key="project.open.time.8" value="1" />
27
-          <entry key="project.opened" value="2" />
26
+          <entry key="project.opened" value="3" />
28 27
         </counts>
29 28
       </usages-collector>
30 29
       <usages-collector id="statistics.file.extensions.edit">
31 30
         <counts>
32
-          <entry key="java" value="3363" />
31
+          <entry key="java" value="4494" />
33 32
         </counts>
34 33
       </usages-collector>
35 34
       <usages-collector id="statistics.file.types.edit">
36 35
         <counts>
37
-          <entry key="JAVA" value="3363" />
36
+          <entry key="JAVA" value="4494" />
38 37
         </counts>
39 38
       </usages-collector>
40 39
       <usages-collector id="statistics.file.extensions.open">
41 40
         <counts>
42
-          <entry key="java" value="2" />
41
+          <entry key="java" value="3" />
43 42
         </counts>
44 43
       </usages-collector>
45 44
       <usages-collector id="statistics.file.types.open">
46 45
         <counts>
47
-          <entry key="JAVA" value="2" />
46
+          <entry key="JAVA" value="3" />
48 47
         </counts>
49 48
       </usages-collector>
50 49
     </session>
@@ -59,15 +58,12 @@
59 58
       <file pinned="false" current-in-tab="true">
60 59
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
61 60
           <provider selected="true" editor-type-id="text-editor">
62
-            <state relative-caret-position="97">
63
-              <caret line="112" column="20" lean-forward="true" selection-start-line="112" selection-start-column="20" selection-end-line="112" selection-end-column="20" />
61
+            <state relative-caret-position="231">
62
+              <caret line="189" column="4" selection-start-line="189" selection-start-column="4" selection-end-line="189" selection-end-column="4" />
64 63
               <folding>
65 64
                 <element signature="imports" expanded="true" />
66
-                <element signature="e#351#352#0" expanded="true" />
67
-                <element signature="e#385#386#0" expanded="true" />
68
-                <element signature="e#456#457#0" expanded="true" />
69
-                <element signature="e#497#498#0" expanded="true" />
70
-                <element signature="e#1551#1560#0" expanded="true" />
65
+                <element signature="e#3653#3654#0" expanded="true" />
66
+                <element signature="e#3679#3680#0" expanded="true" />
71 67
               </folding>
72 68
             </state>
73 69
           </provider>
@@ -76,8 +72,8 @@
76 72
       <file pinned="false" current-in-tab="false">
77 73
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
78 74
           <provider selected="true" editor-type-id="text-editor">
79
-            <state relative-caret-position="181">
80
-              <caret line="282" column="25" selection-start-line="282" selection-start-column="25" selection-end-line="282" selection-end-column="25" />
75
+            <state relative-caret-position="292">
76
+              <caret line="373" column="45" selection-start-line="373" selection-start-column="45" selection-end-line="373" selection-end-column="45" />
81 77
               <folding>
82 78
                 <element signature="imports" expanded="true" />
83 79
               </folding>
@@ -141,7 +137,7 @@
141 137
       </MavenImportingSettings>
142 138
     </option>
143 139
   </component>
144
-  <component name="ProjectFrameBounds" extendedState="1">
140
+  <component name="ProjectFrameBounds">
145 141
     <option name="y" value="23" />
146 142
     <option name="width" value="1280" />
147 143
     <option name="height" value="709" />
@@ -285,7 +281,7 @@
285 281
     <property name="GO_FMT" value="false" />
286 282
     <property name="WebServerToolWindowFactoryState" value="false" />
287 283
     <property name="aspect.path.notification.shown" value="true" />
288
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544101913454" />
284
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544194085762" />
289 285
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
290 286
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
291 287
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -318,7 +314,7 @@
318 314
       </list>
319 315
     </option>
320 316
   </component>
321
-  <component name="RunManager" selected="JUnit.ArrazTest">
317
+  <component name="RunManager" selected="JUnit.ArrazTest.test1RemoveDupesFromArray">
322 318
     <configuration default="true" type="Applet" factoryName="Applet">
323 319
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
324 320
       <method v="2">
@@ -351,6 +347,17 @@
351 347
         <option name="Make" enabled="true" />
352 348
       </method>
353 349
     </configuration>
350
+    <configuration name="ArrazTest.test1RemoveDupesFromArray" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
351
+      <module name="arraz" />
352
+      <option name="PACKAGE_NAME" value="" />
353
+      <option name="MAIN_CLASS_NAME" value="ArrazTest" />
354
+      <option name="METHOD_NAME" value="test1RemoveDupesFromArray" />
355
+      <option name="TEST_OBJECT" value="method" />
356
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
357
+      <method v="2">
358
+        <option name="Make" enabled="true" />
359
+      </method>
360
+    </configuration>
354 361
     <configuration name="ArrazTest.test2CopyArrayByInterator" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
355 362
       <module name="arraz" />
356 363
       <option name="PACKAGE_NAME" value="" />
@@ -389,10 +396,12 @@
389 396
       <item itemvalue="JUnit.ArrazTest" />
390 397
       <item itemvalue="JUnit.ArrazTest.test1CopyArrayByInterator" />
391 398
       <item itemvalue="JUnit.ArrazTest.test2CopyArrayByInterator" />
399
+      <item itemvalue="JUnit.ArrazTest.test1RemoveDupesFromArray" />
392 400
     </list>
393 401
     <recent_temporary>
394 402
       <list>
395 403
         <item itemvalue="JUnit.ArrazTest" />
404
+        <item itemvalue="JUnit.ArrazTest.test1RemoveDupesFromArray" />
396 405
         <item itemvalue="JUnit.ArrazTest.test2CopyArrayByInterator" />
397 406
         <item itemvalue="JUnit.ArrazTest.test1CopyArrayByInterator" />
398 407
       </list>
@@ -412,7 +421,8 @@
412 421
       <workItem from="1543958998826" duration="113000" />
413 422
       <workItem from="1544020724645" duration="762000" />
414 423
       <workItem from="1544059628498" duration="1362000" />
415
-      <workItem from="1544064536860" duration="12053000" />
424
+      <workItem from="1544064536860" duration="12499000" />
425
+      <workItem from="1544144402835" duration="7928000" />
416 426
     </task>
417 427
     <task id="LOCAL-00001" summary="readme and docs">
418 428
       <created>1544021313039</created>
@@ -425,43 +435,42 @@
425 435
     <servers />
426 436
   </component>
427 437
   <component name="TestHistory">
428
-    <history-entry file="ArrazTest - 2018.12.06 at 07h 27m 20s.xml">
438
+    <history-entry file="ArrazTest - 2018.12.06 at 20h 01m 34s.xml">
429 439
       <configuration name="ArrazTest" configurationId="JUnit" />
430 440
     </history-entry>
431
-    <history-entry file="ArrazTest - 2018.12.06 at 07h 37m 07s.xml">
432
-      <configuration name="ArrazTest" configurationId="JUnit" />
441
+    <history-entry file="ArrazTest_test1RemoveDupesFromArray - 2018.12.06 at 20h 40m 58s.xml">
442
+      <configuration name="ArrazTest.test1RemoveDupesFromArray" configurationId="JUnit" />
433 443
     </history-entry>
434
-    <history-entry file="ArrazTest - 2018.12.06 at 07h 53m 14s.xml">
435
-      <configuration name="ArrazTest" configurationId="JUnit" />
444
+    <history-entry file="ArrazTest_test1RemoveDupesFromArray - 2018.12.06 at 20h 42m 02s.xml">
445
+      <configuration name="ArrazTest.test1RemoveDupesFromArray" configurationId="JUnit" />
436 446
     </history-entry>
437
-    <history-entry file="ArrazTest - 2018.12.06 at 07h 53m 53s.xml">
447
+    <history-entry file="ArrazTest - 2018.12.07 at 08h 22m 44s.xml">
438 448
       <configuration name="ArrazTest" configurationId="JUnit" />
439 449
     </history-entry>
440
-    <history-entry file="ArrazTest - 2018.12.06 at 07h 54m 44s.xml">
450
+    <history-entry file="ArrazTest - 2018.12.07 at 08h 22m 48s.xml">
441 451
       <configuration name="ArrazTest" configurationId="JUnit" />
442 452
     </history-entry>
443
-    <history-entry file="ArrazTest - 2018.12.06 at 08h 06m 43s.xml">
453
+    <history-entry file="ArrazTest - 2018.12.07 at 08h 30m 08s.xml">
444 454
       <configuration name="ArrazTest" configurationId="JUnit" />
445 455
     </history-entry>
446
-    <history-entry file="ArrazTest - 2018.12.06 at 08h 07m 08s.xml">
456
+    <history-entry file="ArrazTest - 2018.12.07 at 08h 36m 40s.xml">
447 457
       <configuration name="ArrazTest" configurationId="JUnit" />
448 458
     </history-entry>
449
-    <history-entry file="ArrazTest - 2018.12.06 at 08h 09m 40s.xml">
459
+    <history-entry file="ArrazTest - 2018.12.07 at 08h 38m 07s.xml">
450 460
       <configuration name="ArrazTest" configurationId="JUnit" />
451 461
     </history-entry>
452
-    <history-entry file="ArrazTest - 2018.12.06 at 08h 10m 34s.xml">
462
+    <history-entry file="ArrazTest - 2018.12.07 at 09h 15m 22s.xml">
453 463
       <configuration name="ArrazTest" configurationId="JUnit" />
454 464
     </history-entry>
455
-    <history-entry file="ArrazTest - 2018.12.06 at 08h 11m 09s.xml">
465
+    <history-entry file="ArrazTest - 2018.12.07 at 09h 36m 49s.xml">
456 466
       <configuration name="ArrazTest" configurationId="JUnit" />
457 467
     </history-entry>
458 468
   </component>
459 469
   <component name="TimeTrackingManager">
460
-    <option name="totallyTimeSpent" value="16637000" />
470
+    <option name="totallyTimeSpent" value="25011000" />
461 471
   </component>
462 472
   <component name="ToolWindowManager">
463
-    <frame x="0" y="23" width="1280" height="709" extended-state="1" />
464
-    <editor active="true" />
473
+    <frame x="0" y="23" width="1280" height="709" extended-state="0" />
465 474
     <layout>
466 475
       <window_info content_ui="combo" id="Project" order="0" weight="0.18659128" />
467 476
       <window_info id="Structure" order="1" weight="0.24959612" />
@@ -470,18 +479,18 @@
470 479
       <window_info id="Capture Tool" order="4" />
471 480
       <window_info id="UI Designer" order="5" />
472 481
       <window_info id="Favorites" order="6" side_tool="true" />
473
-      <window_info anchor="bottom" id="Messages" weight="0.32996634" />
474 482
       <window_info anchor="bottom" id="Message" order="0" />
475 483
       <window_info anchor="bottom" id="Find" order="1" />
476
-      <window_info anchor="bottom" id="Run" order="2" weight="0.32996634" />
477
-      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
484
+      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32996634" />
485
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.39730638" />
478 486
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
479 487
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
480 488
       <window_info anchor="bottom" id="TODO" order="6" />
481
-      <window_info anchor="bottom" id="Terminal" order="7" />
482
-      <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
489
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.32996634" />
490
+      <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" weight="0.32996634" />
483 491
       <window_info anchor="bottom" id="Version Control" order="9" />
484 492
       <window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
493
+      <window_info anchor="bottom" id="Messages" order="11" weight="0.32996634" />
485 494
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
486 495
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
487 496
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -500,18 +509,18 @@
500 509
       <window_info id="Capture Tool" order="4" />
501 510
       <window_info id="UI Designer" order="5" />
502 511
       <window_info id="Favorites" order="6" side_tool="true" />
503
-      <window_info anchor="bottom" id="Messages" order="0" weight="0.32996634" />
504
-      <window_info anchor="bottom" id="Message" order="1" />
505
-      <window_info anchor="bottom" id="Find" order="2" />
506
-      <window_info active="true" anchor="bottom" id="Run" order="3" visible="true" weight="0.32996634" />
507
-      <window_info anchor="bottom" id="Debug" order="4" weight="0.4" />
508
-      <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
509
-      <window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
510
-      <window_info anchor="bottom" id="TODO" order="7" />
511
-      <window_info anchor="bottom" id="Terminal" order="8" />
512
-      <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
513
-      <window_info anchor="bottom" id="Version Control" order="10" />
514
-      <window_info anchor="bottom" id="Database Changes" order="11" show_stripe_button="false" />
512
+      <window_info anchor="bottom" id="Message" order="0" />
513
+      <window_info anchor="bottom" id="Find" order="1" />
514
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32996634" />
515
+      <window_info anchor="bottom" id="Debug" order="3" visible="true" weight="0.39730638" />
516
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
517
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
518
+      <window_info anchor="bottom" id="TODO" order="6" />
519
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.32996634" />
520
+      <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
521
+      <window_info anchor="bottom" id="Version Control" order="9" />
522
+      <window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
523
+      <window_info anchor="bottom" id="Messages" order="11" weight="0.32996634" />
515 524
       <window_info anchor="right" id="Commander" order="0" weight="0.4" />
516 525
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
517 526
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -534,9 +543,6 @@
534 543
     <option name="LAST_COMMIT_MESSAGE" value="readme and docs" />
535 544
   </component>
536 545
   <component name="editorHistoryManager">
537
-    <entry file="file://$PROJECT_DIR$/arraz/pom.xml">
538
-      <provider selected="true" editor-type-id="text-editor" />
539
-    </entry>
540 546
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
541 547
       <provider selected="true" editor-type-id="text-editor">
542 548
         <state relative-caret-position="225">
@@ -551,6 +557,9 @@
551 557
         </state>
552 558
       </provider>
553 559
     </entry>
560
+    <entry file="file://$PROJECT_DIR$/arraz/pom.xml">
561
+      <provider selected="true" editor-type-id="text-editor" />
562
+    </entry>
554 563
     <entry file="file://$PROJECT_DIR$/README.md">
555 564
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
556 565
         <state split_layout="SECOND">
@@ -563,8 +572,8 @@
563 572
     </entry>
564 573
     <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
565 574
       <provider selected="true" editor-type-id="text-editor">
566
-        <state relative-caret-position="181">
567
-          <caret line="282" column="25" selection-start-line="282" selection-start-column="25" selection-end-line="282" selection-end-column="25" />
575
+        <state relative-caret-position="292">
576
+          <caret line="373" column="45" selection-start-line="373" selection-start-column="45" selection-end-line="373" selection-end-column="45" />
568 577
           <folding>
569 578
             <element signature="imports" expanded="true" />
570 579
           </folding>
@@ -573,15 +582,12 @@
573 582
     </entry>
574 583
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
575 584
       <provider selected="true" editor-type-id="text-editor">
576
-        <state relative-caret-position="97">
577
-          <caret line="112" column="20" lean-forward="true" selection-start-line="112" selection-start-column="20" selection-end-line="112" selection-end-column="20" />
585
+        <state relative-caret-position="231">
586
+          <caret line="189" column="4" selection-start-line="189" selection-start-column="4" selection-end-line="189" selection-end-column="4" />
578 587
           <folding>
579 588
             <element signature="imports" expanded="true" />
580
-            <element signature="e#351#352#0" expanded="true" />
581
-            <element signature="e#385#386#0" expanded="true" />
582
-            <element signature="e#456#457#0" expanded="true" />
583
-            <element signature="e#497#498#0" expanded="true" />
584
-            <element signature="e#1551#1560#0" expanded="true" />
589
+            <element signature="e#3653#3654#0" expanded="true" />
590
+            <element signature="e#3679#3680#0" expanded="true" />
585 591
           </folding>
586 592
         </state>
587 593
       </provider>

+ 1
- 1
arraz/arraz.iml View File

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 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_8">
4 4
     <output url="file://$MODULE_DIR$/target/classes" />
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">

+ 12
- 0
arraz/pom.xml View File

@@ -7,6 +7,18 @@
7 7
     <groupId>rocks.zipcode.arraysgonewild</groupId>
8 8
     <artifactId>arraz</artifactId>
9 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>8</source>
17
+                    <target>8</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
10 22
     <dependencies>
11 23
         <dependency>
12 24
             <groupId>junit</groupId>

+ 51
- 16
arraz/src/main/java/Arraz.java View File

@@ -2,6 +2,7 @@ import java.util.ArrayList;
2 2
 import java.util.Arrays;
3 3
 import java.util.Iterator;
4 4
 import java.util.List;
5
+import java.util.stream.Stream;
5 6
 
6 7
 public class Arraz {
7 8
 
@@ -122,23 +123,10 @@ public class Arraz {
122 123
     }
123 124
 
124 125
     public int[] removeDupesFromArray(int[] arr) {
125
-        boolean duplicate = false;
126
-        int index = 0;
127
-        int[] newArr = new int[arr.length];
128
-        for(int i = 0;i<arr.length; i++){
129
-            for(int j = i+1; j <arr.length; j++){
130
-                if(arr[i] == arr[j])
131
-                    duplicate = true;
132
-            }
133
-            if(!duplicate) {
134
-                newArr[index] = arr[i];
135
-                index++;
136
-            }
137
-
138
-        }
139
-        return newArr;
126
+       // ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(arr));
127
+       // return newArr;
128
+        return null;
140 129
     }
141
-p
142 130
 
143 131
     public int find2ndLargestValueFromArray(int[] arr) {
144 132
         int max = Integer.MIN_VALUE;
@@ -154,4 +142,51 @@ p
154 142
 
155 143
         return prev;
156 144
     }
145
+
146
+    public List<Integer> makeMeAnArrayListFromArray(int[] arr) {
147
+        return null;
148
+    }
149
+
150
+    public int[] makemeAnArrayFromArrayList(List<Integer> list) {
151
+
152
+        int[] arr = new int[list.size()];
153
+        for(int i = 0; i<list.size();i++){
154
+            arr[i] = list.get(i);
155
+        }
156
+        return arr;
157
+    }
158
+
159
+    public boolean check2ArraysForEqual(int[] arr, int[] arr2) {
160
+
161
+        if(arr.length != arr2.length)
162
+            return false;
163
+
164
+        for(int i = 0; i<arr.length;i++){
165
+            if(arr[i] != arr2[i])
166
+                return false;
167
+        }
168
+        return true;
169
+    }
170
+
171
+    public int averageArrayWithoutMaxMin(int[] arr) {
172
+        int sum = 0;
173
+        int count = 0;
174
+        MaxMin maxMin = findMaxMin(arr);
175
+        for(int n: arr){
176
+            if(n!= maxMin.max && n != maxMin.min) {
177
+                sum += n;
178
+                count += 1;
179
+            }
180
+        }
181
+        return sum/count;
182
+    }
183
+
184
+    public boolean arrayHas65and77(int[] arr) {
185
+        for(int n : arr) {
186
+            if (n != 65 || n != 77)
187
+                return false;
188
+        }
189
+        return true;
190
+    }
191
+
157 192
 }

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

@@ -1,6 +1,10 @@
1 1
 import junit.framework.Assert;
2 2
 import org.junit.Test;
3 3
 
4
+import java.util.ArrayList;
5
+import java.util.Arrays;
6
+import java.util.List;
7
+
4 8
 import static org.junit.Assert.*;
5 9
 
6 10
 public class ArrazTest {
@@ -256,6 +260,7 @@ public class ArrazTest {
256 260
         Assert.assertEquals(expected[0], actual[0]);
257 261
         Assert.assertEquals(expected[1], actual[1]);
258 262
         Assert.assertEquals(expected[2], actual[2]);
263
+        Assert.assertEquals(expected.length, actual.length);
259 264
     }
260 265
 
261 266
     @Test
@@ -284,4 +289,97 @@ public class ArrazTest {
284 289
         int actual = arraz.find2ndLargestValueFromArray(arr);
285 290
         Assert.assertEquals(expected, actual);
286 291
     }
292
+
293
+       @Test
294
+       public void test1MakeMeAnArrayListFromArray(){
295
+           int[] arr = {1,5,8};
296
+
297
+           List<Integer> list = arraz.makeMeAnArrayListFromArray(arr);
298
+         //  Assert.assertEquals(list.containsAll(Arrays.asList(arr)));
299
+
300
+       }
301
+
302
+       @Test
303
+       public void test2MakeMeAnArrayListFromArray() {
304
+
305
+            int[] arr = {1,5,8};
306
+            List<Integer> list = arraz.makeMeAnArrayListFromArray(arr);
307
+
308
+       }
309
+
310
+       @Test
311
+       public void test1MakeMeAnArrayFromArrayList(){
312
+            List<Integer> list = new ArrayList<>();
313
+            list.add(4);
314
+            list.add(8);
315
+            list.add(3);
316
+
317
+            int[] arr = arraz.makemeAnArrayFromArrayList(list);
318
+            Assert.assertEquals(list.size(), arr.length);
319
+       }
320
+
321
+
322
+        @Test
323
+        public void test2MakeMeAnArrayFromArrayList(){
324
+             List<Integer> list = new ArrayList<>();
325
+             list.add(14);
326
+             list.add(80);
327
+             list.add(13);
328
+
329
+             int[] arr = arraz.makemeAnArrayFromArrayList(list);
330
+             Assert.assertEquals(list.size(), arr.length);
331
+        }
332
+
333
+           @Test
334
+           public void test1Check2ArraysForEqual(){
335
+               int[] arr = new int[]{5,3,1,8};
336
+               int[] arr2 = new int[]{5,3,1,8};
337
+               boolean expected = true;
338
+               boolean actual = arraz.check2ArraysForEqual(arr, arr2);
339
+               Assert.assertEquals(expected, actual);
340
+           }
341
+
342
+           @Test
343
+           public void test2Check2ArraysForEqual(){
344
+
345
+                int[] arr = new int[]{3,9,8};
346
+                int[] arr2 = new int[]{5,3,1,8};
347
+
348
+                boolean expected = false;
349
+
350
+                boolean actual = arraz.check2ArraysForEqual(arr, arr2);
351
+                Assert.assertEquals(expected, actual);
352
+           }
353
+
354
+            @Test
355
+            public void test1AverageArrayWithoutMaxMin(){
356
+                int[] arr = new int[]{6,8,9,1};
357
+                int expected = 7;
358
+                int actual = arraz.averageArrayWithoutMaxMin(arr);
359
+                Assert.assertEquals(expected, actual);
360
+            }
361
+
362
+            @Test
363
+            public void test2AverageArrayWithoutMaxMin(){
364
+                int[] arr = new int[]{1,3,6};
365
+                int expected = 3;
366
+                int actual = arraz.averageArrayWithoutMaxMin(arr);
367
+                Assert.assertEquals(expected, actual);
368
+            }
369
+
370
+            @Test
371
+            public void test1ArrayHas65and77(){
372
+                int[] arr = new int[]{65,18,9,77};
373
+                boolean expected = true;
374
+                boolean actual = arraz.arrayHas65and77(arr);
375
+                Assert.assertEquals(expected, actual);
376
+            }
377
+
378
+            @Test
379
+            public void test2ArrayHas65and77(){
380
+                int[] arr = new int[]{51,83,96};
381
+                boolean expected = false;
382
+                boolean actual = arraz.arrayHas65and77(arr);
383
+                Assert.assertEquals(expected, actual);
384
+            }
287 385
 }