cdm/src/main/java/ucar/ma2/ArrayChar.java
public static ArrayChar makeFromStringArray(ArrayObject values, int strlen) {

    // create shape for equivilent charArray
    try {
      Section section = new Section(values.getShape());
      section.appendRange(strlen);

      int[] shape = section.getShape();
      long size = section.computeSize();

      // populate char array
      char[] cdata = new char[(int) size];
      int start = 0;
      IndexIterator ii = values.getIndexIterator();
      while (ii.hasNext()) {
        String s = (String) ii.next();
        for (int k = 0; k < s.length() && k < strlen; k++)
          cdata[start + k] = s.charAt(k);
        start += strlen;
      }

      // ready to create the char Array
      Array carr = Array.factory(DataType.CHAR, shape, cdata);
      return (ArrayChar) carr;
    } catch (InvalidRangeException e) {
      e.printStackTrace();  // cant happen.
      return null;
    }
  }
public static ArrayChar makeFromStringArray(ArrayObject values, int strlen) {

    // create shape for equivilent charArray
    try {
      Section section = new Section(values.getShape());
      section.appendRange(strlen);

      int[] shape = section.getShape();
      long size = section.computeSize();

      // populate char array
      char[] cdata = new char[(int) size];
      int start = 0;
      IndexIterator ii = values.getIndexIterator();
      while (ii.hasNext()) {
        String s = (String) ii.next();
        for (int k = 0; k < s.length() && k < strlen; k++)
          cdata[start + k] = s.charAt(k);
        start += strlen;
      }

      // ready to create the char Array
      Array carr = Array.factory(DataType.CHAR, shape, cdata);
      return (ArrayChar) carr;
    } catch (InvalidRangeException e) {
      e.printStackTrace();  // cant happen.
      return null;
    }
  }
Create an ArrayChar from an ArrayObject of Strings.
Inverse of make1DStringArray. Copies the data.

@param values ArrayObject of String
@param strlen string length dimension size
@return equivilent ArrayChar. Unused are zero filled.