boolean Cib = false;  boolean Cdted = false;
    public void organizeFrames(String[] framePaths, RpfHeader head,                               Vector frames) {        int tail;        int i, j;        boolean done;        /* New, DKS */        boolean Cib = false; /* CIB data flag: 1:I1(10M); 2:I2(5M) */        boolean Cdted = false; /* CDTED data flag: 1: DT1(100M) */        boolean isoverview = false;        boolean islegend = false;        Frame frame;        RpfFileSections.RpfLocationSection loc;        RpfFileSections.RpfCoverageSection coverage;        Debug.message("maketoc",                "MakeToc.organizeFrames: *** initial look at frames ***");        /* # of frames = # of pathname records = #files */        int nFrames = framePaths.length;        if (Debug.debugging("maketoc")) {            Debug.output("Number of frames: " + nFrames);        }        /* for each frame file */        for (i = 0; i < nFrames; i++) {            isoverview = false;            islegend = false;            String framePath = framePaths[i];            if (Debug.debugging("maketoc")) {                Debug.output("MakeToc: frame number " + i + ", " + framePath);            }            try {                BinaryFile binFile = new BinaryBufferedFile(framePath);                // Frame file names are 8.3 notation, might want to                // check                // that here, to blow off dummy files.                String fn = binFile.getName();                if (fn.length() != 12) {                    // Not a RPF Frame file                    if (Debug.debugging("maketoc")) {                        Debug.error("MakeToc: " + framePath                                + " is not a RPF image file - ignoring");                    }                    continue;                }                RpfFileSections rfs = new RpfFileSections();                binFile.seek(0);                if (!head.read(binFile)) {                    // Not a RPF Frame file                    if (Debug.debugging("maketoc")) {                        Debug.error("MakeToc: " + framePath                                + " is not a RPF image file - ignoring");                    }                    continue;                }                binFile.seek(head.locationSectionLocation);                rfs.parse(binFile);                coverage = rfs.parseCoverageSection(binFile);                if (coverage == null) {                    Debug.error("MakeToc: error reading coverage section for "                            + framePath + ", (file " + i + ") skipping");                    binFile.close();                    continue;                }                if (Debug.debugging("maketocframedetail")) {                    Debug.output("MakeToc.organizeFrames: coverage section for "                            + framePath + ", " + coverage);                }                binFile.close();                binFile = null;            } catch (FileNotFoundException e) {                Debug.error("MakeToc: " + framePath                        + " not found, being ignored.");                continue;            } catch (IOException ioe) {                Debug.error("MakeToc: File IO Error during read of: "                        + framePath + "! Being ignored. \n" + ioe);                continue;            }            frame = new Frame();            frames.add(frame);            frame.filename = framePath;            // This will be the actual file name, without parental            // path.            String framename;            tail = frame.filename.lastIndexOf(File.separatorChar);            if (tail == -1) {                framename = frame.filename;            } else {                framename = frame.filename.substring(++tail);            }            if (framename.length() != 12) {                Debug.error("filename must be 12 chars long - " + framename);                return;            }            // 9 is the character after the period.            isoverview = (framename.charAt(9) == 'O');            if (!isoverview) {                islegend = framename.regionMatches(true, 9, "LG", 0, 2);            }            // Check and see of the file thinks it's name is the same            // as it acutally is. If they differ, rule in favor of            // what the frame thinks it is.            //  Let's just be passive here, and name it to whatever it            //  is. If we found the frame, then we'll find it later,            //  too. -DFD            //          if (!framename.equals(head.filename)) { /* DKS */            //              File file = new File(frame.filename);            //              File newFile = new File(frame.filename.substring(0,            // tail),            //                                      head.filename);            //              file.renameTo(newFile);            //              framename = head.filename;            //              Debug.output("WARNING: File \"" + framename +            //                           "\" doesn't match internal name \"" + head.filename +            //                           "\" - Fixed.");            //          }            isoverview = false;            islegend = false;            String padding = null;            String seriesCode = head.filename.substring(9, 11);            RpfProductInfo rpi = RpfProductInfo.get(seriesCode);            String scaleString = rpi.scaleString;            if (rpi == RpfConstants.UK) {                Debug.output("MakeToc: " + frame.filename                        + " unknown map type " + seriesCode + " - ignoring.");                continue;            } else if (rpi.scale == RpfConstants.Various) {                // need to figure out how to consult the frame for                // what it is.                // RpfAttributes.chartSeriesCode might have something                // to base it off.                // GNC = GN, JNC = JN, ONC = ON, TPC = TP, JOG = 15,                // TLM50 = V7,                // But I'm not sure about the others. For now, prompt                // for scale.                scaleString = promptForScale("What is the scale for "                        + frame.filename                        + "? (Answer should look like: 1:XXX,XXX)");                if (scaleString == null || scaleString.length() == 0) {                    Debug.error("Bad input for scale for " + frame.filename                            + ", skipping.");                    continue;                }            }            if (rpi.dataType.equalsIgnoreCase(RpfConstants.CIB)) {                frame.cib = true;            } else if (rpi.dataType.equalsIgnoreCase(RpfConstants.CDTED)) {                frame.cdted = true;            } // else do nothing for CADRG            // Set the string to length 15            if (scaleString.length() < 15) {                padding = createPadding(15 - scaleString.length(), false);                scaleString = scaleString + padding;            } else if (scaleString.length() > 15) {                scaleString = scaleString.substring(0, 15);            }            frame.scale = scaleString;            frame.zone = head.filename.charAt(11);            if (isoverview) {                coverage.nwlat = coverage.nelat = coverage.nwlon = coverage.swlon = coverage.swlat = coverage.selat = coverage.nelon = coverage.selon = 0;                coverage.latInterval = coverage.lonInterval = coverage.nsVertRes = coverage.ewHorRes = 0;            }            if (islegend) {                coverage.nwlat = coverage.nelat = coverage.nwlon = coverage.swlon = coverage.swlat = coverage.selat = coverage.nelon = coverage.selon = 0;                coverage.latInterval = coverage.lonInterval = coverage.nsVertRes = coverage.ewHorRes = 0;            }            /*             * PBF 6-18-94 check for rectangular coverage or polar             * frame             */            if (frame.zone == '9' || frame.zone == 'J') {                /*                 * Polar. Convert boundary from lat-long degrees to                 * pixels                 */                /* DKS 1/95: North pole: "9" code */                if (frame.zone == '9') {                    if (Debug.debugging("maketoc"))                        Debug.output("Processing NORTH pole");                    frame.left = (90.0 - coverage.nwlat)                            * Math.sin(coverage.nwlon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.right = (90.0 - coverage.selat)                            * Math.sin(coverage.selon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.top = -1 * (90.0 - coverage.nwlat)                            * Math.cos(coverage.nwlon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.bottom = -1 * (90.0 - coverage.selat)                            * Math.cos(coverage.selon * Math.PI / 180.0)                            / coverage.latInterval;                } else { /* DKS 1/95: South pole: "J" code */                    if (Debug.debugging("maketoc"))                        Debug.output("Processing SOUTH pole");                    frame.left = (90.0 + coverage.nwlat)                            * Math.sin(coverage.nwlon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.right = (90.0 + coverage.selat)                            * Math.sin(coverage.selon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.top = (90.0 + coverage.nwlat)                            * Math.cos(coverage.nwlon * Math.PI / 180.0)                            / coverage.latInterval;                    frame.bottom = (90.0 + coverage.selat)                            * Math.cos(coverage.selon * Math.PI / 180.0)                            / coverage.latInterval;                } /* if South pole */                /* DKS 8/1/94: Added for GEOREF calc later */                frame.swlat = coverage.swlat;                frame.swlon = coverage.swlon;                if (Debug.debugging("maketoc")) {                    Debug.output("MakeToc: " + frame.filename                            + " is a Polar frame");                } /* if Debug.debugging("maketoc") */            } else {                frame.left = coverage.nwlon;                frame.right = coverage.selon;                /*                 * NEW, DKS 6/94. Correct for frame straddling 180                 * deg.                 */                if (coverage.selon < coverage.nwlon) {                    frame.right = 180.0;                }                frame.top = coverage.nwlat;                frame.bottom = coverage.selat;            }            frame.h_interval = coverage.lonInterval;            frame.v_interval = coverage.latInterval;            frame.h_resolution = coverage.ewHorRes;            frame.v_resolution = coverage.nsVertRes;            frame.marked = false;            if (Debug.debugging("maketocframedetail")) {                Debug.output("MakeToc: nw_lon = " + coverage.nwlon                        + ", se_lon = " + coverage.selon                        + "\n         nwlat = " + coverage.nwlat + ", selat = "                        + coverage.selat + "\n    NEW: swlat = "                        + coverage.swlat + ", swlon = " + coverage.swlon                        + "\n         vert_interval = " + coverage.latInterval                        + ", horiz_interval = " + coverage.lonInterval                        + "\n         vertical resolution = "                        + coverage.nsVertRes + ", horizontal resolution = "                        + coverage.ewHorRes + "\n         left = " + frame.left                        + ", right = " + frame.right + "\n         top = "                        + frame.top + ", bottom = " + frame.bottom + "\n");            }        } /* for i: each input frame file */    }