Are you feeling beaten down by the stock market? You're not alone. The stock market experienced its worst first half of a year in more than five decades. Very few investors have been able to defy gravity as both the Nasdaq Composite Index and S&P 500 entered bear markets. 

Even if you're down, you absolutely don't have to be out. The next six months could be critical in helping you build the foundation for wealth over the long run. And you don't have to come up with a game plan on your own. Here are three things the world's smartest investors will do in the second half of 2022 to beat the market.

1. Stay calm

Will the stock market remain volatile throughout the rest of the year? Probably so. There are multiple factors that could cause big price swings. Perhaps the biggest question mark is whether or not the U.S. economy enters into a recession.

Just because the market could be volatile doesn't mean that you should be. The world's best investors know the importance of staying calm when stocks go through tumultuous periods.

Jack Bogle, the mutual fund pioneer who ranks among the most influential investors of all time, told CNBC in 2018 that investors should always "stay the course." He warned that "your emotions will defeat you totally" if you try to move in and out of the market. Bogle passed away in 2019, but his advice still rings true.

2. Invest selectively

Another iconic investor, Warren Buffett, once famously stated, "Be fearful when others are greedy and greedy when others are fearful." Unsurprisingly, Buffett has led Berkshire Hathaway to buy more stocks in recent months than the giant conglomerate has done in a while.

However, Buffett hasn't been indiscriminately greedy. He has bought 16 stocks so far in 2022, and many of them are value stocks. For example, Berkshire initiated a large position in HP (HPQ -4.14%). The technology stock trades at less than eight times expected earnings.

Buffett has focused on winning sectors, as well -- especially energy. Chevron (CVX -0.05%) now ranks as Berkshire's fourth-largest holding. It's been a huge winner for Buffett, with shares soaring more than 20% year to date despite a recent pullback.

Berkshire has also scooped up a boatload of shares of another energy stock, Occidental Petroleum (OXY -0.93%). It now owns a 16.4% stake in Oxy, leading some to speculate that Buffett might even want to acquire the oil and gas producer.

Should you buy HP, Chevron, and Oxy just because Buffett did? No. But it does make sense to have the same mindset as the legendary investor. View market downturns as opportunities to buy shares of well-run companies at a discount. Focus on the sectors that are most likely to be winners. Invest -- but do so selectively.

3. Focus on the long term

I know it's a cliché, but it's important to focus on the long term. It's hard, if not impossible, to think of any great investors who only have a short-term outlook.

Pershing Square Holdings CEO Bill Ackman has been tremendously successful through the years. The hedge-fund manager's net worth totals $2.8 billion, according to Forbes. He stated in a recent investor call something that's especially worthy of note:

We are not a trading firm trying to position ourselves so that we are going to outperform the market in six months, nine months, even 12 months. What we do is, we look to find businesses that we think we can own for years, in some cases, decades or more.

This echoes Buffett's words in his most recent letter to Berkshire Hathaway shareholders. He wrote, referring to himself and his longtime business partner Charlie Munger:

Whatever our form of ownership, our goal is to have meaningful investments in businesses with both durable economic advantages and a first-class CEO. Please note particularly that we own stocks based upon our expectations about their long-term business performance and not because we view them as vehicles for timely market moves. That point is crucial: Charlie and I are not stock-pickers; we are business-pickers.

Investors who aren't billionaires would do well to have the same focus as Ackman and Buffett. Sure, buying stocks for the long term won't guarantee that you'll beat the market in the second half of this year. But buying stocks in the second half of 2022 with a long-term outlook will likely significantly increase your prospects of beating the market over the next decade and beyond.