public static boolean moveUp(Alignment alignment,int firstRow,int lastRow){
  lastRow=Math.min(lastRow,alignment.getNumberOfSequences());
  if (firstRow <= 0 || firstRow > lastRow)   return false;
 else {
    Integer[] array=new Integer[alignment.getNumberOfSequences()];
    for (int i=0; i < alignment.getNumberOfSequences(); i++)     array[i]=alignment.getOrder(i);
    int replaced=array[firstRow - 1];
    System.arraycopy(array,firstRow,array,firstRow - 1,lastRow + 1 - firstRow);
    array[lastRow]=replaced;
    alignment.setOrder(Arrays.asList(array));
    return true;
  }
}

public static boolean moveUp ( Alignment alignment , int firstRow , int lastRow ) { lastRow = Math . min ( lastRow , alignment . getNumberOfSequences ( ) ) ; if ( firstRow <= 0 || firstRow > lastRow ) return false ; else { Integer [ ] array = new Integer [ alignment . getNumberOfSequences ( ) ] ; for ( int i = 0 ; i < alignment . getNumberOfSequences ( ) ; i ++ ) array [ i ] = alignment . getOrder ( i ) ; int replaced = array [ firstRow - 1 ] ; System . arraycopy ( array , firstRow , array , firstRow - 1 , lastRow + 1 - firstRow ) ; array [ lastRow ] = replaced ; alignment . setOrder ( Arrays . asList ( array ) ) ; return true ; } }
move the selected interval of sequences up one
