Script to auto restart java for 100 percent

I want the tomcat to restart when java goes 100% cpu utilize and remain on this , Get pid kill and start tomcat .

top | grep java 

We can get pid and cpu utilize , But how can we do on run time.