Bismihi ta'ala
From a fiqhi perspective, a male is allowed to wear shorts, even if it is above his knees.
In Sunni fiqh, according to most of their madhhabs, the knee is considered to be included in the private parts ('awra), so it must all be covered, from the naval to the knees.
However, according to the Shi'i Ja'fari school of thought, the only wajib part to cover is the private parts alone, front and back.
If a male prays in shorts, the prayer will be valid, although it is not very much advisable to do so, as we must honour the prayer and present ourselves to the Almighty in the most dignified and elegant way possible. That's why, for example, it's so mustahab to use perfume before praying, and so on.
As for going out in public with shorts, whether they reach the knees or above the knees, this would depend on the society that you live in. For sports or swimming there would not be any issue, but outside of sports, or swimming, we must take into strong consideration whether it is socially acceptable or not.
This is also where the topic of libas al-shuhra would be discussed, and we can leave that for another time.
If one lives in a non-Muslim society, it does not mean he abandons his religious appearance or cultural upbringing, or changes his moral standards. A male also has a form of hijab and modesty, and he must observe this as much as possible.
Is it appropriate for a pious mu'min to be seen wearing shorts casually in public? Most people would answer with a no. A mu'min always sets high standards for himself, and tries to represent his faith and religion in the best form possible, all the time.
And Allah knows best.