Academy & Industry Research Collaboration Center (AIRCC)

Volume 11, Number 17, October 2021

An Algorithm-Adaptive Source Code Converter to Automate the Translation from Python to Java


Eric Jin1 and Yu Sun2, 1USA, 2California State Polytechnic University, USA


In the fields of computer science, there exist hundreds of different programming languages. They often have different usage and strength but also have a huge number of overlapping abilities [1]. Especially the kind of general-purpose coding language that is widely used by people, for example Java, Python and C++ [2]. However, there is a lack of comprehensive methods for the conversion for codes from one language to another [3], making the task of converting a program in between multiple coding languages hard and inconvenient. This paper thoroughly explained how my team designs a tool that converts Python source code into Java which has the exact same function and features. We applied this converter, or transpiler, to many Python codes, and successfully turned them into Java codes. Two qualitative experiments were conducted to test the effectiveness of the converter. 1. Converting Python solutions of 5 United States Computer Science Olympic (USACO) problems into Java solutions and conducting a qualitative evaluation of the correctness of the produced solution; 2. converting codes of various lengths from 10 different users to test the adaptability of this converter with randomized input. The results show that this converter is capable of an error rate less than 10% out of the entire code, and the translated code can perform the exact same function as the original code.


Algorithm, programing language translation, Python, Java.