public class SampleFinal3C { public static void main(String[] arg) { System.out.println(grunf("Hxxxx","AOPE", "Bx")); // this is going to be the answer to the question System.out.println(grunf("Happy","NOPE", "Party")); System.out.println(methodA(3, 4)); System.out.println(methodA(-1, -3)); System.out.println(methodA(6, 6)); } public static String grunf(String s1, String s2, String s3) { String s = s1.substring(1,2); // s becomes charAt 1 in s1 // if s1 is longer than s2 and s2 is lexicographically smaller than s3 // and s occurs in s3 if (s1.length()>s2.length() && s2.compareTo(s3)<0 && s3.indexOf(s)>0) return s1.substring(0,1) + s2.substring(1); else return s1.substring(0,1) + s2.substring(0,1) + s1.substring(0,1); } static int methodA(int x, int y) { /** if (x < y) return -1; else if (x==y) return 0; else return 1; **/ return x