Deciding when to drink coffee can be challenging, but a new study can help you figure out the best time. Researchers from the United States Army developed an algorithm that makes personal recommendations for timing your caffeine consumption. It aims to have you drink the least amount of coffee to achieve the maximum level of alertness. The algorithm helped study participants increase their alertness by up to 64 percent without consuming any more caffeine than normal. It also found that with the right dosing schedule, people could reduce their caffeine consumption by up to 65 percent and still achieve peak alertness. Study co-author Jaques Reifman explains, “The algorithm hinges on our ability to accurately predict how an individual responds to sleep deprivation and how an individual responds to caffeine.” While it was originally developed for army workers, it will also eventually be offered online for anyone to use.