import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.regex.Pattern;

public class MoreArrayc {

        Arraz cool = new Arraz();

    public int findIndexOf(Integer[] arr, int value) {

        int container = 0;


        for (int i = 0; i < arr.length; i++) {

            if (arr[i] == value) {
                container = i;

            }
        }
        return container;
    }

    public Integer[] copyArrayByIteratingthroughIt(Integer [] arr){

        ArrayList<Integer> arr1 = new ArrayList<Integer>(Arrays.asList(arr));
        Iterator<Integer> interate = arr1.iterator();
        Integer [] arr2 = new Integer[arr.length];
        int count = 0;


        while (interate.hasNext()){

            arr2[count] = interate.next();
            count++;

        }

        return arr2;

    }

    public Integer[] copyArrayByLoopingthroughIt(Integer [] arr){


        Integer [] arrCop = new Integer[arr.length];

        for (int i = 0; i <arr.length ; i++) {

            arrCop[i] = arr[i];
        }

        return arrCop;

    }

    public Boolean checkArrayForEquals(Integer[]arr,Integer []arr2){

            Boolean flag = null;



        for (int i = 0; i < arr.length; i++) {

            if(arr[i] == arr2[i]){
                flag = true;
            }else{
                flag = false;
            }
    }
        return flag;
    }

    public Integer[] removeFromArray(Integer [] arr, int value){

        int size = arr.length;

        int index = findIndexOf(arr,value);

        for (int i = index; i < size -1; i++) {

                arr[i] = arr[i+1];
        }


        size = size - 1;

        Integer[] cop = Arrays.copyOf(arr,size);
        return cop;

    }

    public Integer find2ndLargestValueFromArray(Integer [] arr){

        Integer maxNum;
        Integer secondMax;

       if(arr.length <= 1){
           return arr[0];
       }

       if(arr[0] < arr[1]) {
            maxNum = arr[1];
            secondMax = arr[0];

       }else{
           maxNum = arr[0];
           secondMax = arr[1];
       }

        for (int i = 2; i < arr.length; i++) {

            if(arr[i] > maxNum){

                secondMax =maxNum;
                maxNum = arr[i];

            }else if(arr[i] < maxNum && arr[i] > secondMax){
                secondMax = arr[i];
            }

        }
        return secondMax;
    }

    public Integer[] sortingArrays (Integer [] arr) {

        return null;


    }

    public void makeAnArrayListfromArray(){

    }
    public void capacity(int mincap){



    }



    public Integer[] ArrayFromArrayList(ArrayList<Integer> arrlist){

        return null;

    }

    public ArrayList<Integer> AnArrayFromArrayList(Integer[] arr){
        return null;
    }

    public Boolean arraysHas65N77 (Integer arr [],int n , int k){

        Boolean flag  = null;

        for (int i = 0; i <arr.length ; i++) {


            if (cool.containsValue(arr, n)&&cool.containsValue(arr,k)) {
                flag = true;
            }else{
                flag = false;
            }
        }
        return flag;
    }

    public Integer sumArrays (Integer [] arr){


        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
        }
        int sum = 0;
        for (int e : arr) sum += e;

        return sum;
    }

    public Integer[] makeMeACopyplz (Integer [] arr){
        Arraz arraz = new Arraz();


        Integer[] arr2 = copyArrayByIteratingthroughIt(arr);
        Integer[] arr3 = arraz.reverseAnArray(arr2);

        return arr3;
    }

    public Integer[] insertAtStartAndCopy(Integer[] arr,int value){

        return null;

    }




}


//    makeMeAnArrayListFromArray
//    makeMeAnArrayFromArrayList

//   averageArrayWithoutMaxMin


//    insertAtStartAndCopy
//    insertAtEndAndCopy
//    sortArrayIntoEvensThenOdds
