code: private static void requestAndSetSpecificTimeOffsetsFromKafka(
  			SimpleConsumer consumer,
  			List<KafkaTopicPartitionState<TopicAndPartition>> partitions,
  			long whichTime) throws IOException {
  		Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<>();
  		for (KafkaTopicPartitionState<TopicAndPartition> part : partitions) {
  			requestInfo.put(part.getKafkaPartitionHandle(), new PartitionOffsetRequestInfo(whichTime, 1));
  		}
  
  		requestAndSetOffsetsFromKafka(consumer, partitions, requestInfo);
  	}
docs: Request offsets before a specific time for a set of partitions, via a Kafka consumer.
  
  @param consumer The consumer connected to lead broker
  @param partitions The list of partitions we need offsets for
  @param whichTime The type of time we are requesting. -1 and -2 are special constants (See OffsetRequest)