input: Write a function that converts a given Java code snippet to Python 3. The function should take a string input of the Java code and return the corresponding Python 3 code as a string. If the input is not a valid Java code snippet, the function should return an empty string. The function should handle the conversion of Java methods to Python functions and ensure the correct syntax is maintained.
  assert convert_java_to_python("public class Foo {\n  public int foo( int a, int b ) {\n    return a + b;\n  }\n}") == "def foo(a, b):\n return a + b"
  assert convert_java_to_python("public class Bar {\n  public int bar( int x ) {\n    return x * x;\n  }\n}") == "def bar(x):\n return x * x"
  assert convert_java_to_python("public class Invalid {\n  public void invalid( int y ) {\n    y = y / 0;\n  }\n}") == ""
  assert convert_java_to_python("public class Empty {\n  public void empty() {\n  }\n}") == "def empty():\n pass"
  assert convert_java_to_python("") == ""
output: def convert_java_to_python(java_code):
      if not java_code.strip():
          return ""
      
      import re
      method_pattern = re.compile(r'public\s+\w+\s+(\w+)\s*\(([^)]*)\)\s*\{([^}]*)\}')
      match = method_pattern.search(java_code)
      
      if not match:
          return ""
      
      method_name = match.group(1)
      params = match.group(2).replace("int ", "").replace(" ", "").split(",") if match.group(2) else []
      body = match.group(3).strip()
      
      if "return" not in body:
          body = "pass"
      else:
          body = body.replace("return ", "").strip()
      
      python_function = f"def {method_name}({', '.join(params)}):\n return {body}" if body != "pass" else f"def {method_name}({', '.join(params)}):\n pass"
      return python_function