java doesn't support the simple swap function