public static void paint(Ocean sea) {
    if (sea != null) {
      int width = sea.width();
      int height = sea.height();

      /* Draw the ocean. */
      for (int x = 0; x < width + 2; x++) {
        System.out.print("-");
      }
      System.out.println();
      for (int y = 0; y < height; y++) {
        System.out.print("|");
        for (int x = 0; x < width; x++) {
          int contents = sea.cellContents(x, y);
          if (contents == Ocean.SHARK) {
            System.out.print('S');
          } else if (contents == Ocean.FISH) {
            System.out.print('F');
          } else {
            System.out.print('~');
          }
        }
        System.out.println("|");
      }
      for (int x = 0; x < width + 2; x++) {
        System.out.print("-");
      }
      System.out.println();
    }
  }