if (line.xpoints == null || line.xpoints.length == 0 || line.xpoints[0].length == 0) {  return null; }
    protected static Point[] locateArrowHeads(int arrowDirection,					      int arrowLocation,					      OMLine line) {	//NOTE: xpoints[0] refers to the original copy of the xpoints,	//as opposed to the [1] copy, which gets used when the line	//needs to wrap around the screen and show up on the other	//side.  Might have to think about the [1] points, and adding	//a arrowhead there if it shows up in the future.	int pointIndex = line.xpoints[0].length - 1;	if (Debug.debugging("arrowheads")) {	    Debug.output("createArrowHeads(): Number of points = " + pointIndex);	}	int drawingLinetype = OMLine.STRAIGHT_LINE; // default	if (pointIndex > 1) {	    drawingLinetype = OMLine.CURVED_LINE;	}	// Used as the index for points in the xy point array to use	// as anchors for the arrowheads	int[] end = new int[2];	int[] start = new int[2];	end[0] = pointIndex;	start[0] = 0;	end[1] = 0;	start[1] = pointIndex;			// better names:	int origEnd = pointIndex;	int origStart = 0;							int numArrows = 1; // default	if ( arrowDirection == OMArrowHead.ARROWHEAD_DIRECTION_BOTH ) {	    numArrows = 2;	}	// one for the start and end of each arrowhead (there could be two)	Point sPoint1 = new Point();	Point ePoint1 = new Point();	Point sPoint2 = new Point();	Point ePoint2 = new Point();	// do we have to reverse the arrows?	if (line.arc != null && line.arc.getReversed() == true) {	    if (arrowDirection == OMArrowHead.ARROWHEAD_DIRECTION_FORWARD) {		arrowDirection = OMArrowHead.ARROWHEAD_DIRECTION_BACKWARD;	    } else if (arrowDirection == OMArrowHead.ARROWHEAD_DIRECTION_BACKWARD) {		arrowDirection = OMArrowHead.ARROWHEAD_DIRECTION_FORWARD;	    }	}	switch(drawingLinetype) {	case OMLine.STRAIGHT_LINE:	    Debug.message("arrowheads","createArrowHeads(): Inside x-y space");	    int newEndX;	    int newEndY;	    int dx, dy;	    float dd;	    // backwards arrow	    if ( needBackwardArrow(arrowDirection)) {		// need to have the newEndX/Y point at the original start.		newEndX = line.xpoints[0][origStart];		newEndY = line.ypoints[0][origStart];		if ( arrowLocation != 100 ) {		    // find out where the location should be, but in reverse.		    dx = line.xpoints[0][origStart] - line.xpoints[0][origEnd];		    dy = line.ypoints[0][origStart] - line.ypoints[0][origEnd];		    int offset = 0;		    // Straight up or down		    if (dx == 0) {			// doesn't matter, start and end the same			newEndX = line.xpoints[0][origEnd];			// calculate the percentage from start of line			offset = (int)((float)dy*(arrowLocation/100.0f));			// set the end at the begining...			newEndY = line.ypoints[0][origEnd] + offset;		    } else {															dd = Math.abs((float)dy/(float)dx);			// If the line moves more x than y			if (Math.abs(dx) > Math.abs(dy)) {			    // set the x			    newEndX = line.xpoints[0][origEnd] +				(int)((float)dx*(arrowLocation/100.0));			    // find the y for that x and set that			    newEndY = line.ypoints[0][origEnd];			    offset = (int)((float)Math.abs(line.xpoints[0][origEnd] - newEndX)*dd);			    if ( dy < 0 ) {				newEndY -= offset;			    } else {				newEndY += offset;			    }			} else  {			    // switch everything...set y end			    newEndY = line.ypoints[0][origEnd] +				(int)((float)dy*(arrowLocation/100.0));			    // initialize the x to beginning			    newEndX = line.xpoints[0][origEnd];			    // calculate the difference x has to move based on y end			    offset = (int)((float)Math.abs(line.ypoints[0][origEnd] - newEndY)/dd);			    // set the end			    if (dx < 0) {				newEndX -= offset;			    } else {				newEndX += offset;			    }			}								    }		} // if (arrowLocation != 100)		if (start[1] < 0 ) {		    start[1] = 0;		}		// which point do we copy to?		if ( numArrows == 2 ) {		    // we copy the backwards arrow to sPoint2/ePoint2		    sPoint2.x = line.xpoints[0][origEnd];		    sPoint2.y = line.ypoints[0][origEnd];		    ePoint2.x = newEndX;		    ePoint2.y = newEndY;		} else {		    // we copy the backwards arrow to sPoint1/ePoint1		    sPoint1.x = line.xpoints[0][origEnd];		    sPoint1.y = line.ypoints[0][origEnd];		    ePoint1.x = newEndX;		    ePoint1.y = newEndY;		}	    } // end if needBackwardArrow.	    if ( needForwardArrow(arrowDirection)) {		newEndX = line.xpoints[0][origEnd];		newEndY = line.ypoints[0][origEnd];		if ( arrowLocation != 100 ) {		    // find out where the location should be.		    dx = line.xpoints[0][origEnd] - line.xpoints[0][origStart];		    dy = line.ypoints[0][origEnd] - line.ypoints[0][origStart];		    int offset = 0;		    // Straight up or down		    if (dx == 0) {			// doesn't matter, start and end the same			newEndX = line.xpoints[0][origStart];			// calculate the percentage from start of line			offset = (int)((float)dy*(arrowLocation/100.0f));			// set the end at the begining...			newEndY = line.ypoints[0][origStart] + offset;								    } else {															dd = Math.abs((float)dy/(float)dx);			// If the line moves more x than y			if (Math.abs(dx) > Math.abs(dy)) {			    // set the x			    newEndX = line.xpoints[0][origStart] +				(int)((float)dx*(arrowLocation/100.0f));			    // find the y for that x and set that			    newEndY = line.ypoints[0][origStart];			    offset = (int)((float)Math.abs(line.xpoints[0][origStart] - newEndX)*dd);			    if (dy < 0) {				newEndY -= offset;			    } else {				newEndY += offset;			    }			} else {			    // switch everything...set y end			    newEndY = line.ypoints[0][origStart] +				(int)((float)dy*(arrowLocation/100.0));			    // initialize the x to beginning			    newEndX = line.xpoints[0][origStart];			    // calculate the difference x has to move based on y end			    offset = (int)((float)Math.abs(line.ypoints[0][origStart] - newEndY)/dd);			    // set the end			    if (dx < 0) {				newEndX -= offset;			    } else {				newEndX += offset;			    }			}								    }		} //end if (arrowLocation != 100)		// finally, copy the results to sPoint1/ePoint1		// no longer needed: if (start[0] < 0) { start[0] = 0; }		sPoint1.x = line.xpoints[0][origStart];		sPoint1.y = line.ypoints[0][origStart];		ePoint1.x = newEndX;		ePoint1.y = newEndY;	    }	    break;	case OMLine.CURVED_LINE:	    Debug.message("arrowheads","createArrowHeads(): Curved line arrowhead");							    if ( needBackwardArrow(arrowDirection)) {						Debug.message("arrowheads","createArrowHeads(): direction backward and");						// compute the backward index....		int bindex = pointIndex - (int)((float)pointIndex*(float)(arrowLocation/100.0));		if ( bindex == 0 ) { 		    bindex = 1;		}									if ( numArrows == 2 ) { 		    // copy it to s/ePoint2							    sPoint2.x = line.xpoints[0][bindex];		    sPoint2.y = line.ypoints[0][bindex];		    ePoint2.x = line.xpoints[0][bindex-1];		    ePoint2.y = line.ypoints[0][bindex-1];		} else {		    // copy it to s/ePoint1							    sPoint1.x = line.xpoints[0][bindex];		    sPoint1.y = line.ypoints[0][bindex];		    ePoint1.x = line.xpoints[0][bindex-1];		    ePoint1.y = line.ypoints[0][bindex-1];							}																	    } // end if (needBackwardArrow(arrowDirection))				    if ( needForwardArrow(arrowDirection)) { 						int findex = (int)((float)pointIndex*(float)(arrowLocation/100.0));		if ( findex == pointIndex ) { 		    findex = findex - 1;		}						sPoint1.x = line.xpoints[0][findex];		sPoint1.y = line.ypoints[0][findex];		ePoint1.x = line.xpoints[0][findex+1];		ePoint1.y = line.ypoints[0][findex+1];									    } //end if (needForwardArrow(arrowDirection))				    break;	} // end switch(drawingLinetype)	Point[] ret = new Point[numArrows*2];	// Should be at least 1, maybe 2	ret[0] = sPoint1;	ret[1] = ePoint1;	if (numArrows > 1) {	    ret[2] = sPoint2;	    ret[3] = ePoint2;	}	return ret;    }