fork download
  1. class Example {
  2. public static void main(String[] args) throws Exception {
  3. String s = "admin\0\0\0\0\0\0\0";
  4.  
  5. System.out.println(s);
  6. System.out.println(s.length());
  7.  
  8. s = s.replaceAll(new String(new byte[] {0}, "UTF-8"), "");
  9. System.out.println(s.length());
  10. }
  11.  
  12. static {
  13. Thread.currentThread()
  14. .setUncaughtExceptionHandler((t, e) ->
  15. e.printStackTrace(System.out));
  16. }
  17. }
Success #stdin #stdout 0.17s 320576KB
stdin
Standard input is empty
stdout
admin
12
5