```
public void sortColors(int[] nums) {
int[] hash = new int[256];
for(int num: nums)
{
if(num == 0)
hash['r']++;
else if(num == 1)
hash['w']++;
else
hash['b']++;
}
//for()
int i = 0;
while(hash['r']-- > 0)
nums[i++] = 0;
while(hash['w']-- > 0)
nums[i++] = 1;
while(hash['b']-- > 0)
nums[i++] = 2;
}
```