I found the answer after more searching online, I don't want to answer my own question caused I will look like a douche but the forum doesn't allow me to remove this question when there are answers(though not to my question)
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Record> query = cb.createQuery(Record.class);
Root sm = query.from(Record.class);
List<Predicate> predicateList = new ArrayList();
predicateList.add(cb.greaterThanOrEqualTo(sm.get(COL_TIMESTAMP), startDate));
predicateList.add(cb.lessThanOrEqualTo(sm.get(COL_TIMESTAMP), endDate));
if (predicateList.size() > 0)
{
query.where(predicateList.toArray(new Predicate[predicateList.size()]));
}
**query.orderBy(cb.desc(sm.get(COL_TOTALRECORD)));**
List<Record> tempList = em.createQuery(query)
.setFirstResult(0)
.setMaxResults(10)
.getResultList();
This is what I was looking for
query.orderBy(cb.desc(sm.get(COL_TOTALRECORD)));