public static long calculateOffsetInMs ( int intervalInMinutes , int offsetInMinutes ) { while ( offsetInMinutes < 0 ) { offsetInMinutes = intervalInMinutes + offsetInMinutes ; } while ( offsetInMinutes > intervalInMinutes ) { offsetInMinutes -= intervalInMinutes ; } return offsetInMinutes * MINUTE_IN_MS ; }
Reformulates negative offsets or offsets larger than interval .