void (Graphics g, int xStart, int xEnd, int y) { int startSegment = xStart / WAVE_SEGMENT_LENGTH; int endSegment = xEnd / WAVE_SEGMENT_LENGTH; for (int i = startSegment; i < endSegment; i++) { drawWaveSegment(g, WAVE_SEGMENT_LENGTH * i, y); } int x = WAVE_SEGMENT_LENGTH * endSegment; g.drawLine(x, y + WAVE_HEIGHT, x + WAVE_SEGMENT_LENGTH / 2, y); }