package ru.job4j.array;

import java.util.Arrays;
/**
 * Program ArrayDuplicate.
 *
 * @author Vladimir Zhirnov (mailto:harabe@yandex.ru)
 * @since 26.07.2017
 * @version 0.1
 */
 public class ArrayDuplicate {
 	/**
 	 * The Method remove duplicate values.
 	 * @param array - string array
 	 * @return an array without duplicates
 	 */
 	public String[] remove(String[] array) {
 		for (int i = 0; i < array.length; i++) {
 			for (int j = array.length - 1; j > i; j--) {
 				if (array[i] == array[j] && array[j] != array[array.length - 1]) {
 					array[j] = array[array.length - 1];
 					array = Arrays.copyOf(array, array.length - 1);
 				} else if (array[i] == array [j] && array[j] == array[array.length - 1]) {
 						array = Arrays.copyOf(array, array.length - 1);
 					}
 			}
 		}
 	return Arrays.copyOf(array, array.length);
 	}
 }
@@ -374,16 +374,53 @@
 ray) %7B%0A 
+%09String temp = %22%22;%0A%09int counter = 0;%0A
 %09%09for (i
@@ -445,16 +445,26 @@
 y.length
+ - counter
 ; i++) %7B
@@ -464,19 +464,21 @@
  i++) %7B%0A
- %09%09
+%09    
 %09for (in
@@ -482,16 +482,27 @@
 (int j =
+ i + 1; j %3C
  array.l
@@ -513,26 +513,24 @@
 h - 
-1; j %3E i; j--
+counter; j++
 ) %7B%0A
- 
 %09%09%09%09
@@ -543,70 +543,61 @@
 ray%5B
-i%5D == array%5Bj%5D && array%5Bj%5D != array%5Barray.length - 1%5D) %7B%0A %09%09%09%09
+j%5D.equals(array%5Bi%5D)) %7B%0A%09%09    %09temp = array%5Bj%5D;%0A%09%09    
 %09arr
@@ -630,46 +630,34 @@
  - 1
-%5D;%0A %09%09%09%09%09array = Arrays.copyOf(
+ - counter%5D;%0A%09%09    %09
 array
-, 
+%5B
 arra
@@ -672,157 +672,73 @@
  - 1
-);%0A %09%09%09%09%7D else if (array%5Bi
+ - counter
 %5D =
-=
  array
- 
 %5Bj%5D
- && array%5Bj%5D == array%5Barray.length - 1%5D) %7B%0A %09%09%09%09%09%09array = Arrays.copyOf(array, array.length - 1);%0A %09
+;%0A%09%09    %09counter++;%0A%09%09    %09j--;%0A
 %09%09%09%09%7D%0A
- %09%09
+%09    
 %09%7D%0A 
@@ -783,16 +783,26 @@
 y.length
+ - counter
 );%0A %09%7D%0A 

fix ArrayDuplicate