首先比长度,长的更大。长度相等则调用compareTo即可:

import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt(), k1 = sc.nextInt();
        int x2 = sc.nextInt(), k2 = sc.nextInt();
        StringBuilder v1 = new StringBuilder("");
        StringBuilder v2 = new StringBuilder("");
        while(k1-- > 0) v1.append(x1);
        while(k2-- > 0) v2.append(x2);
        if(v1.length() > v2.length()){
            System.out.println("Greater");
            return;
        }
        if(v1.length() < v2.length()){
            System.out.println("Less");
            return;
        }
        String s1 = v1.toString(), s2 = v2.toString();
        if(s1.compareTo(s2) == 0){
            System.out.println("Equal");
            return;
        }
        if(s1.compareTo(s2) > 0){
            System.out.println("Greater");
            return;
        }
        if(s1.compareTo(s2) < 0){
            System.out.println("Less");
            return;
        }
    }
}