If you need to find out the password of a WiFi connection a given device — yours or not! — was connected to, then you can do so if you have root access. Not otherwise, root is a must for this trick to work.
All you need to do is check out a file called WPA_supplicant. conf under /data/misc/wifi folder of your device. If we are to do some explaining, you basically cannot excess /data folder unless oyu have root, hence the need for root access.
Once you have rooted your Android device, use a root explorer app like ES File Manager to browse to /data/misc/wifi folder, and then simply open the WPA_supplicant. conf file.
You will see all connections and their passwords that the device ever connected (unless and until it was factory reset). That’s your whole lot of WiFi passwords you were looking for.