You can develop in java on a phone within http://termux.com (term + linux repo)... if you're comfortable in vim or emacs.
These two together provide a functional and workable environment for me. I haven't tried the DeX-station, but I believe that too could be quite workable with a phone.
Hacker's Keyboard (app) is the recommended onscreen keyboard (has ESC etc).
But really need a bluetooth keyboard e.g. logitech K480 or fullsize logitech K375s - or regular USB one if your phone has OTG. Bonus: doubles screen space.
Physical keyboard! With a full size one, it really feels like a unix terminal. Which it is. And very fast by 70's unix standards.