How can I make this code shorter ?
Code for simplifying fractions import java.util.Scanner; public class SimplifyingFractions { public static double smaller(double refer1,double refer2) { if(refer1<=refer2) { return refer1; } else { return refer2 ; } } public static void main (String[]args){ Scanner ask = new Scanner(System.in); double a,b ; a = ask.nextDouble(); b = ask.nextDouble(); double x = smaller(a,b); do { if(x !=1 && x==a && a%b==0 && a/b - Math.floor(a/b)==0) { int Ia,Ib; Ia = (int) a; Ib = (int) b ; System.out.println("(1) "+Ia/Ib); break; } else if(x !=1 && a<b && a%x==0 && b%x==0 && a/x-Math.floor(a/x)==0 && b/x-Math.floor(b/x)==0) { double r1,r2 ; r1 = a/x; r2 = b/x; int Ir1,Ir2; Ir1 = (int) r1; Ir2 = (int) r2; System.out.println("(2) "+Ir1+"/"+Ir2); break; } else if (x==a && a%b!=0 && a/x-Math.floor(a/x)!=0 && b/x-Math.floor(b/x)!=0) { int Ia,Ib; Ia = (int) a; Ib = (int) b ; System.out.println("(3) "+Ia+"/"+Ib); break; } } while(x<=a || x<=b) ; } }