I need to determine whether a specific class is a particular primitive type, an int in my case. I found Class.isPrimitive() method, but I don't need to check all primitives, I need a particular one. I noticed that the class names are equal to primitive names and I considered checking for candidateClass.getName().equals("int") - but it seemed a bad practice (and a "magic string" use).
How to check for a specific primitive type properly using Java API?