J.k. Rowling said this quote

Harry — I think I've just understood something! I've got to go to the library!”And she sprinted away, up the stairs. does she understand?” said Harry distractedly, still looking around, trying to tell where the voice had come from.“Loads more than I do,” said Ron, shaking his head.“But why’s she got to go to the library?”“Because that’s what Hermione does,” said Ron, shrugging. “When in doubt, go to the library.