Algorithm implementation of training and testing Perceptron in JAVA