Detecting students' attention in class provides key information to teachers to capture and retain students' attention. Traditionally, such information is collected manually by human observers. Wearable devices, which have received a lot of attention recently, are rarely discussed in this field. In view of this, we propose a multimodal system which integrates a head-motion module, a pen-motion module, and a visual-focus module to accurately analyze students' attention levels in class. These modules collect information via cameras, accelerometers, and gyroscopes integrated in wearable devices to recognize students' behaviors. From these behaviors, attention levels are inferred for various time periods using a rule-based approach and a data-driven approach. The former infers a student's attention states using user-defined rules, while the latter relies on hidden relationships in the data. Extensive experimental results show that the proposed system has excellent performance and high accuracy. To the best of our knowledge, this is the first study on attention level inference in class using wearable devices. The outcome of this research has the potential of greatly increasing teaching and learning efficiency in class.