```
public static void method(int a, int b){
final PrintStream oldOut = System.out;
PrintStream ps=new PrintStream(new FilterOutputStream(oldOut) {
boolean meetOne = false;
@
Override public void write(int b) throws IOException {
if( b =='0'){
oldOut.write('0');
oldOut.write(b);
}
else if(b == '1'){
if(!meetOne){
meetOne = true;
oldOut.write(b);
}
else {
oldOut.write('2');
}
}
else {
oldOut.write(b);
}
}
});
System.setOut(ps);
}
```