Java: working version of quote commands