/** Convert a camera area into a human-readable string. */
  public static String stringFromArea(Camera.Area area) {
    if (area == null) {
      return null;
    } else {
      StringBuilder sb = new StringBuilder();
      Rect r = area.rect;

      sb.setLength(0);
      sb.append("([");
      sb.append(r.left);
      sb.append(',');
      sb.append(r.top);
      sb.append("][");
      sb.append(r.right);
      sb.append(',');
      sb.append(r.bottom);
      sb.append(']');

      sb.append(',');
      sb.append(area.weight);
      sb.append(')');

      return sb.toString();
    }
  }
  /**
   * Convert a camera area list into a human-readable string
   *
   * @param areaList a list of areas (null is ok)
   */
  public static String stringFromAreaList(List<Camera.Area> areaList) {
    StringBuilder sb = new StringBuilder();

    if (areaList == null) {
      return null;
    }

    int i = 0;
    for (Camera.Area area : areaList) {
      if (area == null) {
        sb.append("null");
      } else {
        sb.append(stringFromArea(area));
      }

      if (i != areaList.size() - 1) {
        sb.append(", ");
      }

      i++;
    }

    return sb.toString();
  }