@Test public void printTwoHeart() throws Exception { System.out.println("two heart:"); OtherUtil.printTwoHeart(); }
public static void printTwoHeart() { int i, j, e, a, t1; final int I = 8, R = 150; for (i = 1, a = I; i <= I / 2; i++, a--) { t1 = 6; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); t1 = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); t1 = 2 * t1; t1 += (int) (2 * Math.sqrt(I * I - (a - i) * (a - i))); t1 = 20 - t1; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); System.out.print("\n"); } for (i = 1; i <= R / 2; i++) { if (i % 2 != 0 || i % 3 != 0) continue; t1 = 6; if (i == 6) System.out.print(">>----"); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); t1 = (int) (R - Math.sqrt(R * R - i * i)); t1 = 2 * t1; t1 += (int) (2 * (Math.sqrt(R * R - i * i) - (R - 2 * I))); t1 = 35 - t1; if (i == 6) System.out.print("LOVE"); else if (i == 48) System.out.print("\t "); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); if (i == 6) System.out.print("----->"); System.out.print("\n"); } }
OtherUtil { public static void printTwoHeart() { int i, j, e, a, t1; final int I = 8, R = 150; for (i = 1, a = I; i <= I / 2; i++, a--) { t1 = 6; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); t1 = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); t1 = 2 * t1; t1 += (int) (2 * Math.sqrt(I * I - (a - i) * (a - i))); t1 = 20 - t1; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); System.out.print("\n"); } for (i = 1; i <= R / 2; i++) { if (i % 2 != 0 || i % 3 != 0) continue; t1 = 6; if (i == 6) System.out.print(">>----"); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); t1 = (int) (R - Math.sqrt(R * R - i * i)); t1 = 2 * t1; t1 += (int) (2 * (Math.sqrt(R * R - i * i) - (R - 2 * I))); t1 = 35 - t1; if (i == 6) System.out.print("LOVE"); else if (i == 48) System.out.print("\t "); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); if (i == 6) System.out.print("----->"); System.out.print("\n"); } } }
OtherUtil { public static void printTwoHeart() { int i, j, e, a, t1; final int I = 8, R = 150; for (i = 1, a = I; i <= I / 2; i++, a--) { t1 = 6; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); t1 = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); t1 = 2 * t1; t1 += (int) (2 * Math.sqrt(I * I - (a - i) * (a - i))); t1 = 20 - t1; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); System.out.print("\n"); } for (i = 1; i <= R / 2; i++) { if (i % 2 != 0 || i % 3 != 0) continue; t1 = 6; if (i == 6) System.out.print(">>----"); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); t1 = (int) (R - Math.sqrt(R * R - i * i)); t1 = 2 * t1; t1 += (int) (2 * (Math.sqrt(R * R - i * i) - (R - 2 * I))); t1 = 35 - t1; if (i == 6) System.out.print("LOVE"); else if (i == 48) System.out.print("\t "); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); if (i == 6) System.out.print("----->"); System.out.print("\n"); } } private  OtherUtil(); }
OtherUtil { public static void printTwoHeart() { int i, j, e, a, t1; final int I = 8, R = 150; for (i = 1, a = I; i <= I / 2; i++, a--) { t1 = 6; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); t1 = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); t1 = 2 * t1; t1 += (int) (2 * Math.sqrt(I * I - (a - i) * (a - i))); t1 = 20 - t1; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); System.out.print("\n"); } for (i = 1; i <= R / 2; i++) { if (i % 2 != 0 || i % 3 != 0) continue; t1 = 6; if (i == 6) System.out.print(">>----"); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); t1 = (int) (R - Math.sqrt(R * R - i * i)); t1 = 2 * t1; t1 += (int) (2 * (Math.sqrt(R * R - i * i) - (R - 2 * I))); t1 = 35 - t1; if (i == 6) System.out.print("LOVE"); else if (i == 48) System.out.print("\t "); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); if (i == 6) System.out.print("----->"); System.out.print("\n"); } } private  OtherUtil(); static void printSimpleHeart(boolean isFull); static void printTwoHeart(); }
OtherUtil { public static void printTwoHeart() { int i, j, e, a, t1; final int I = 8, R = 150; for (i = 1, a = I; i <= I / 2; i++, a--) { t1 = 6; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); t1 = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); t1 = 2 * t1; t1 += (int) (2 * Math.sqrt(I * I - (a - i) * (a - i))); t1 = 20 - t1; while (t1-- != 0) System.out.print(" "); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (2 * (I - Math.sqrt(I * I - (a - i) * (a - i)))); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * Math.sqrt(I * I - (a - i) * (a - i)); e++) System.out.print("*"); for (j = (int) (I - Math.sqrt(I * I - (a - i) * (a - i))); j > 0; j--) System.out.print(" "); System.out.print("\n"); } for (i = 1; i <= R / 2; i++) { if (i % 2 != 0 || i % 3 != 0) continue; t1 = 6; if (i == 6) System.out.print(">>----"); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); t1 = (int) (R - Math.sqrt(R * R - i * i)); t1 = 2 * t1; t1 += (int) (2 * (Math.sqrt(R * R - i * i) - (R - 2 * I))); t1 = 35 - t1; if (i == 6) System.out.print("LOVE"); else if (i == 48) System.out.print("\t "); else while (t1-- != 0) System.out.print(" "); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); for (e = 1; e <= 2 * (Math.sqrt(R * R - i * i) - (R - 2 * I)); e++) System.out.print("*"); for (j = (int) (R - Math.sqrt(R * R - i * i)); j > 0; j--) System.out.print(" "); if (i == 6) System.out.print("----->"); System.out.print("\n"); } } private  OtherUtil(); static void printSimpleHeart(boolean isFull); static void printTwoHeart();  }