EARNINGS PER SHARE - Computation of basic and diluted earnings per share (Details) - USD ($)
$ / shares in Units, shares in Thousands, $ in Thousands
3 Months Ended 12 Months Ended
Jun. 30, 2019
Mar. 31, 2019
Dec. 31, 2018
Sep. 30, 2018
Jun. 30, 2018
Mar. 31, 2018
Dec. 31, 2017
Sep. 30, 2017
Jun. 30, 2019
Jun. 30, 2018
Jun. 30, 2017
Numerator:                      
Net income $ 70,895 $ 88,300 $ 77,796 $ 85,703 $ 70,085 $ 102,739 $ (51,459) $ 74,925 $ 322,694 $ 196,290 $ 257,506
Denominator:                      
Weighted-average shares used in computing basic net income per share (in shares)                 71,435 77,179 81,478
Weighted-average shares used in computing diluted net income per share (in shares)                 71,602 78,331 83,252
Net income per share of common stock:                      
Basic (in dollars per share) $ 1.01 $ 1.25 $ 1.09 $ 1.16 $ 0.95 $ 1.34 $ (0.66) $ 0.93 $ 4.52 $ 2.54 $ 3.16
Diluted (in dollars per share) $ 1.01 $ 1.25 $ 1.09 $ 1.16 $ 0.94 $ 1.32 $ (0.66) $ 0.92 $ 4.51 $ 2.51 $ 3.09
Stock options                      
Denominator:                      
Dilutive potential common shares (in shares)                 87 1,074 1,670
Restricted stock units                      
Denominator:                      
Dilutive potential common shares (in shares)                 80 78 104