Can anyone tell me how to write a code which will run with minimum time complexity. Here is the code that I have.

```
public int singleNumber(int[] A) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int i,j;
if (A.length == 0) {
System.out.print(true);
return 0;
}
for (i = 0; i < A.length; i++) {
for (j = i+1; j < A.length-1; j++) {
if (A[i] > A[j]) {
int temp = A[i];
A[i] = A[j];
A[j] = temp;
}
}
}
for (i = 0; i < A.length; i++) {
System.out.print(A[i]+" ");
}
i=0; j=i+1;
while (j<A.length){
if (A[i] != A[j]) {
return A[i];
}
i = i + 2;
j = j + 2;
}
return A[i];
}
```