Instead of using toString() maybe it's better to add a printTape, and let run() return nothing. I have also converted UTM to a struct, because for this little program it doesn't need to be a class (and there is no need of new).
I meant the opposite, sorry:
printTape() ==> toString() Bye, bearophile