There's no need to 'adapt' it to digital. But you are asking a fairly broad question without giving much information. Check your manual to see which ones should be used and which ones shouldn't for your particular camera and or lens.
You can "use" AI or AIS lenses on any modern-day Nikon DSLR. This includes the D40 and the D40x. All Nikon cameras will mount the lenses w/o damage.
The following cameras will require operation in fully manual mode:
D40, D40x, D50, D70, D70s, D80, D1X*, D1H*
The following cameras will work in both manual and aperture-preferred modes (ie the camera will meter on the lens after you input the focal length and max. aperture via a menu option [on D200 it's called non-CPU lens]):
D200, D300, D2H, D2Hs, D2X, D2Xs, D3
* I'm not sure whether these ones will meter as well.
The D40 acts like a D70/80 in regards to AI(s) lenses. The D40 is the only Nikon digital that can also take Non-ai lenses, due to the design of the AI sense pin. The D40, D70, D80, and (I think) D100 will take manual lenses, but there will be no metering, unlike the D1/2/3 (including the D1x and D1h, Avi ) and the D200/300.
AND....to add more relevant information to this thread, you can have a CPU chip added to manual focus lenses in order to allow metering with the DSLR bodies that don't already allow this (e.g., sub-D200 bodies). But good luck these days because the folks that offer this service are getting few and far between. http://www.naturfotograf.com/lens_CPUconversion.html
Thanks to everyone here. I'm currently a Canon guy but I've been looking on this side for better ergos and opportunity. I came from Nikon and still own several ai and ais lenses and would consider the investment if it seems worthy. Particularly if I could use them without a $200 dollar adaptor. I'm afraid if I go look at a body I'll come home with a lighter wallet.