fork(1) download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. String[] tests = {
  4. "0.12345678901234567890",
  5. "123.456",
  6. "1234.12345678901234567890123",
  7. "0.123456789012345678",
  8. };
  9.  
  10. for (String str : tests) {
  11. str = str.replaceAll("(?<=\\..{18}).*", "");
  12. System.out.println(str);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.09s 52016KB
stdin
Standard input is empty
stdout
0.123456789012345678
123.456
1234.123456789012345678
0.123456789012345678