Pointer to even digit
int j = 0 ; String ans = " " ; while ( i < odd . size ( ) && j < even . size ( ) ) { if ( odd . get ( i ) < even . get ( j ) ) ans += ( char ) ( odd . get ( i ++ ) + '0' ) ; else ans += ( char ) ( even . get ( j ++ ) + '0' ) ; }