#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
string s = { "gfg" };
bool val
= next_permutation(s.begin(),
s.end());
if (val == false)
cout << "No Word Possible"
<< endl;
else
cout << s << endl;
return 0;
}
As you can see in the code, there is a next permutation function in c++. more on the next permutation function code here. However, I want to know if there is a similar function in Java.