001package algs11; 002 003public class XRuler { 004 public static void ruler(int height) { 005 if (height < 1) { 006 return; 007 } 008 ruler(height / 2); 009 System.out.format("%d ", height); 010 ruler(height / 2); 011 } 012 public static void sideways(int height) { 013 if (height < 1) { 014 return; 015 } 016 sideways(height - 1); 017 for (int i=0; i<height; i++) { 018 System.out.print ("-"); 019 } 020 System.out.println(); 021 sideways(height - 1); 022 } 023 public static void main (String[] args) { 024 //ruler(8); 025 sideways(5); 026 } 027 028}