port source to Java6 (for Andrdoid compatibility)