标签云

微信群

扫码加入我们

WeChat QR Code

I've got a very strange question. Say I am implementing an object that has a toString() method that returns a single string formatted in a square, as such:010203040506070809Now, clearly the entire string, when listed character-wise (and excluding the terminating \0), is as such:010203\n040506\n070809\nHow would I go about concatenating entire square blocks like these? For instance, if I wanted to have:010203 101112010203101112040506+131415 =040506131415070809 161718070809161718How could I do this? Note that I cannot import Java.util or any other classes.Edit:The example above was merely an example; ideally I'd like the solution to be extensible to an arbitrarily large number of 'square objects', where I could just call a hypothetical aSquareObject.squareConcat(otherSquareObject).squareConcat(anotherSquareObject).....squareConcat(finalSquareObject) method and it'd spit out two, three, five, fifteen squares side by side.


Have you tried something already?

2019年06月26日37分30秒

What hinders you from printing just that block out?

2019年06月26日37分30秒