For thirty years," he said, "I've sailed the seas and seen good and bad, better and worse, fair weather and foul, provisions running out, knives going, and what not. Well, now I tell you, I never seen good come o' goodness yet.(Stevenson 199)
Jim had to become a pirate to restore legality, this does not make him bad, but Justice is served due to his acts of piracy being for the purpose of good.
"But I see you was the right sort. I say to myself: You stand by Hawkins, John, he's yours! ... You save your witness and he'll save your neck!" (Stevenson 222)
Whether Silver switched for greed, Jim's virtue created a change of heart.
"Here you are, in a bad way: ship lost, treasure lost, men lost; your whole business gone to wreck; and if you want to know who did it -- it was I!" (Stevenson 219)