# SJBCD: A Java Code Clone Detection Method Based on
## 2 Related Works  
According to different code representation methods, code clone detection methods can be divided into methods based on text, token, abstract syntax trees, and graph (program flow graphs, program dependency graphs, etc.). The main idea of text-based methods is to treat source code as a sequence of characters and use the difference between two character sequences as the difference between code fragments. Representative methods include NICAD [13], Duploc [14], SSD [15] and so on. After normalizing the code, NICAD uses the Longest Common Subsequence algorithm to compare the text lines of potential clones. Duploc first removes comments, whitespace, etc., and then uses a string-matching algorithm to detect code clones. The above two methods have good detection effects for T1 and T2 clones, but the results are not ideal when detecting code clones at the syntax and semantic levels. The main idea of token-based methods is to extract the information from source code and present it in the form of word sequences. Common token-based detection methods include CCAligner [16], CCLearner [17], and so on. CCLearner customizes token rules, uses reserved words, method identifiers, variable identifiers, and some abstract syntax trees information as features, performs numerical calculations in groups, and puts them into a deep neural network model for supervised training. CCLearner has advantages over text-based detection methods. In recent years, token methods are often combined with other program information and do not appear alone. The detection methods based on tree and graph transform source code into abstract syntax trees, program flow graphs, program dependency graphs, etc. for clone detection. Recently, methods based on trees and graphs include TBCCD [18], [PERSON] [19], [PERSON] et al. [20], and so on. TBCCD converts source code into Abstract Syntax Trees (AST), which are then represented as word vectors and trained using a convolutional network. [PERSON] extracts program dependency graphs of source code through soot [21], and combines graph neural network technology and Siamese neural network to detect code clones. These methods have good detection effects on Type-3 and Type-4 clones. In addition to the above methods detecting source code clones, there are also some methods based on compiled code. [PERSON] et al. [22] proposed a binary file code clone detection method based on the suffix tree for C language. The method disassembles binary executable files to obtain assembly instruction sequences, opcode sequences, and instruction type sequences and then constructs suffix trees of these sequences for code clone detection. In Java language, some scholars have also conducted research on code clone detection in binary code. Java language uses virtual machine technology, and bytecode is a special binary code for Java virtual machine. [PERSON] et al. [9] conducted related research and proposed a code clone detection method based on bytecode sequence alignment, which uses the Smith-Waterman algorithm to align bytecode sequences for accurate matching, and the method also considers the similarities between instruction sequences and method calling sequences. However, the semantic information of opcodes is not considered. These methods can perform code clone detection in scenarios where only compiled code instead of source code can be obtained. With the development of deep learning technologies, code clone detection methods are gradually approaching the direction of machine learning and deep learning from traditional methods. Deep learning technologies are increasingly combined with code clone detection technology. Type-3 and Type-4 clones that were once difficult to detect can also be detected with higher precision and recall [23]. DeepSim [24] encodes the control flow and data flow of the code into a semantic matrix, where each element represents a high-dimensional sparse binary feature vector. Additionally, a novel deep-learning model is designed to quantify code similarity.