@@ -0,0 +1,1165 @@
+package com.matao.fundamentals.exercises;%0A%0A/**%0A * Created by matao on 2018/9/28.%0A * %3Cp%3E%0A * A string s is a circular rotation of a string t if it matches%0A * when the characters are circularly shifted by any number of positions;%0A * e.g., ACTGACG is a circular shift of TGACGAC, and vice versa.%0A * %3Cp%3E%0A * Detecting this condition is important in the study of genomic sequences.%0A * Write a program that checks whether two given strings s and t are circular shifts of one another.%0A * Hint: The solution is a one-liner with indexOf(), length(), and string concatenation.%0A */%0Apublic class Ex_1_2_06 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        String s1 = %22ACTGACG%22;%0A        String s2 = %22TGACGAC%22;%0A        System.out.println(isCircularShifts(s1, s2));%0A%0A        s1 =%22matao%22;%0A        s2 =%22taoma%22;%0A        System.out.println(isCircularShifts(s1, s2));%0A%0A        s1 =%22matao%22;%0A        s2 =%22taoam%22;%0A        System.out.println(isCircularShifts(s1, s2));%0A    %7D%0A%0A    public static boolean isCircularShifts(String s1, String s2) %7B%0A        if (s1.length() == s2.length() && s1.concat(s1).indexOf(s2) %3E= 0) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

add solution to exercise 1.2.06