```
public class Solution {
public void sortColors(int[] nums) {
if(nums==null||nums.length==0)
return ;
int j;
for (int i = 1; i < nums.length; i++) {
j=i;
int temp = nums[i];
while(j>0&&nums[j-1]>temp){
nums[j]=nums[j-1];
j--;
}
nums[j]= temp;
}
}
}
```