More black executives are getting an opportunity in the NBA, a league where most of the players look like them.

The most recent example: The Sacramento Kings hired Brandon D. Williams as assistant general manager on Sunday, replacing Scott Perry, who left to become general manager of the New York Knicks.

A year ago, the NBA had only two black presidents of basketball operations in Los Angeles Clippers president and coach Doc Rivers and the Toronto Raptors’ Masai Ujiri. There were two black general managers in the New Orleans Pelicans’ Dell Demps and the Knicks’ Steve Mills. Keep in mind that the NBA is about 75 percent black.

Today, the NBA has four black presidents of basketball operations in Rivers, Ujiri, Mills and the Los Angeles Lakers’ Magic Johnson, and three black general managers in Demps, Perry and the Cleveland Cavaliers’ Koby Altman. The Knicks have the NBA’s lone black president and general manager duo with Mills and Perry.

Williams, who spent the previous four seasons with the Philadelphia 76ers, believes the trend is finally going in the right direction for black NBA executives.

“Everybody is becoming more conscious,” Williams said. “There is an increased interest in diversifying our roots beyond the team building and the voices, resumes and experience that is around the guys and our communities. So I don’t feel like there has been some specific targeting, but I do feel like the result of a lot of open dialogue in conversation has been productive. The Knicks have taken a bold step, which opened an opportunity for me. I hope in some way that the vote of confidence that the guys showed me in Sacramento opens up another opportunity for African-American GMs.”

The 42-year-old Williams most recently served as the 76ers’ vice president of basketball administration as well as general manager of the NBA G-League’s Delaware 87ers. The former Davidson University star spent nine seasons working for the NBA as director of NBA player development (2005-07) and associate vice president of basketball operations (2007-13). Williams also earned a law degree from Rutgers University in 2012.

“I’m excited because it’s a continuation of some of the things that I’ve been doing,” Williams said. “I’ve been trying to think forward and put the right things in place to support our guys that are marketable with the right coaches, the right staff and culture. When I was walking around Sacramento, I saw [the nickname] ‘Sacramento Proud.’ There is a rich history that [former Kings star center and current general manager] Vlade [Divac] could speak to more directly. There are a lot of people that want to see [success], and I want to be part of it.

“Now is going to be my opportunity to showcase. I’m going to continue to put the players together and do my work. I have a chance to step up and do more.”

The odds of being a black NBA front-office executive seem longer for former NBA players. Johnson is the only former player who is a president of an NBA team, although fellow Hall of Famer Michael Jordan does own the Charlotte Hornets. Demps is the only former NBA player who is an NBA general manager.

Free-agent guard Dahntay Jones and former NBA player Damien Wilkins were among the players who took part in a National Basketball Players Association seminar for aspiring front-office executives recently in Las Vegas, and they expressed hope that more blacks with NBA playing experience will land executive roles.

Williams and pending Knicks hire Gerald Madkins are two former NBA players who have recently landed NBA assistant general manager roles. Williams played professionally for nine seasons, including stints with the Golden State Warriors, San Antonio Spurs and Atlanta Hawks.

Williams believes his time as a player in the NBA, the G-League and overseas will help him not only as an executive but also in the Kings’ locker room.

“I’m proud of my [playing] career,” Williams said. “It was a very nomadic career. There was a cup of [NBA] coffee here and there. A different job every year for me. But it gave me a chance to see the world of basketball on many different levels and build great relationships and learn from a lot of coaches and a lot of different players that have now grown up in different spaces of the game. So my playing experience gave me a jump-start on my ability to manage because I was always looking at transition, integration and how to contribute to something.”

Williams is ecstatic to work with Divac and called team owner Vivek Ranadivé “forward-thinking” and realistic about the rebuilding that still needs to be done. Sacramento has not been to the playoffs since 2006, has made a lot of questionable draft moves in recent years and has struggled to sign notable free agents. But under Perry, the Kings had a strong 2017 NBA draft, selecting a much-needed point guard in De’Aaron Fox of Kentucky with the fifth overall pick. The Kings also traded the 10th pick to the Portland Trail Blazers in exchange for the 15th and 20th selections and selected North Carolina forward Justin Jackson and Duke center Harry Giles, respectively. Sacramento also used the 34th overall pick in the second round to draft Kansas guard Frank Mason, who was the consensus college basketball player of the year last season.

In a quest to change the Kings’ culture, Perry noted that they added four rookies who all came from winning college programs. Perry played a pivotal role in the signing of veteran forward Vince Carter, veteran forward-center Zach Randolph and point guard George Hill, who started for the Utah Jazz last season. The Knicks took notice and hired Perry, who was fired from the Orlando Magic earlier this year.

“There is an opportunity to build on this momentum, and things are starting to look a little bit differently. The situation is encouraging, and I look at the team the exact same way. What they did opened the door to the possibility that things can improve quickly,” Williams said.