input: Write a function to convert a given Java code snippet to Python 3. The function should take the Java code snippet as a string, convert it to the equivalent Python 3 code, and return the Python 3 code as a string. If the input Java code is invalid or cannot be converted, the function should return an empty string.
  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 * 2;\n  }\n}') == 'def bar(x):\n return x * 2'
  assert convert_java_to_python('public class Invalid {') == ''
  assert convert_java_to_python('') == ''
output: def convert_java_to_python(java_code):
      if not java_code or 'public class' not in java_code:
          return ''
      
      try:
          class_name = java_code.split('public class ')[1].split('{')[0].strip()
          method_start = java_code.find('public')
          method_end = java_code.find('}', method_start)
          method_code = java_code[method_start:method_end].strip()
          
          method_name = method_code.split('public')[1].split('(')[0].strip()
          params = method_code.split('(')[1].split(')')[0].split(',')
          params = [p.split()[-1] for p in params]
          params_str = ', '.join(params)
          
          body = method_code.split('{')[1].split('}')[0].strip()
          body = body.replace('return', 'return ')
          
          python_code = f"def {method_name}({params_str}):\n return {body}"
          return python_code
      except:
          return ''