I was asked to write, to remove the element `(lets say k=30)` from the array and shift the other elements to its left without using inbuilt methods.

I have tried the below approach.

```
public static void main(String[] args) {
    // TODO Auto-generated method stub

    int[] arr = new int[] { 1, 2, 30, 4, 5, 30, 6 };

    int k = 30;
    int count = 0;

    System.out.println("---Original Array------");
    for (int i = 0; i < arr.length; i++) {
        System.out.print(arr[i] + " ");
    }

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

        if (arr[i] == k)
            count++;
    }

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

            if (arr[i] == k) {
                for (int l = i; l < arr.length - 1; l++) {
                    arr[l] = arr[l + 1];
                }
            }
        }

    }

    System.out.println("---Modified Array------");
    for (int i = 0; i < arr.length; i++) {
        System.out.print(arr[i] + " ");
    }

}

```

I need output like this: `[1 2 4 5 6 0 0]`  

But the output from the above logic is: `[1 2 4 5 6 6 6]`  

Also, I'm worried about using nested for loops here. Is there any way that we can reduce the time complexity with out using any inbuilt methods?