Jake Peralta (Andy Samberg) and Rosa Diaz (Stephanie Beatriz) find themselves behind bars at the end of Brooklyn Nine-Nine season 4, with the beginning of the next season dealing with how Jake and Rosa get out of jail. During one of the sitcom's multi-episode arcs, the pair joined an undercover team specializing in bank robbers to help get to the notorious Golden Gang Bank Robbers. However, things turned for the worse when the detectives were framed for a crime they didn't commit by dirty NYPD lieutenant Melanie Hawkins (Gina Gershon) and her team.
https://screenrant.com/brooklyn-99-jake-rosa-prison-time-how-long/