I run my code. The answer I got is the same with the except output and the running time is not exceed. But my answer is not accept. Could anybody have any idea?

PS: this is my solution:

```
public class Solution {
/**
* @param A: an array of integers
* @return: an integer
*/
public int firstMissingPositive(int[] A) {
// write your code here
if(A == null || A.length == 0){
return 1;
}
for(int i = 0; i < A.length; i++){
if(A[i] <= 0 || A[i] > A.length){
break;
}
if(A[i] != i + 1){
int temp = A[i];
A[i] = A[temp - 1];
A[temp - 1] = temp;
}
else{
break;
}
}
for(int i = 0; i < A.length; i++){
if(A[i] != i + 1){
return i + 1;
}
}
return A.length + 1;
}
```

}